This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-07-29 12:23:39

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Stop Script when an event occurs.

I am making a game called Diamond Boreness but I cant figure out how to make the player lose when he touches a shooting star. This script wont work

(If-Touching mouse-pointer)
Stop all

Anyone knows how to make it?

Offline

 

#2 2012-07-29 12:26:56

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: Stop Script when an event occurs.

well, make sure your script is surrounded by a forever loop.

when gf clicked
forever
if <touching [mouse-pointer v]?>
stop all
end
If you did this already, let me know.

Last edited by powerpoint56 (2012-07-29 12:27:18)


http://i48.tinypic.com/2072ctw.gif

Offline

 

#3 2012-07-29 12:47:21

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Re: Stop Script when an event occurs.

Oh, i see now, thank you a lot, what i still dont get is why surround it with a forever loop?

Offline

 

#4 2012-07-29 12:52:58

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: Stop Script when an event occurs.

lithor wrote:

Oh, i see now, thank you a lot, what i still dont get is why surround it with a forever loop?

So that it checks if it's touching the mouse pointer more than once. The only way you can do it without the forever loop:

when gf clicked
wait until <touching [mouse-pointer v]?>
stop all


http://i50.tinypic.com/312u714.jpg

Offline

 

#5 2012-07-29 12:54:58

lithor
New Scratcher
Registered: 2012-07-25
Posts: 13

Re: Stop Script when an event occurs.

oh, i understand now, thank you a ton. Try the game now, it has the shooting stars  wink

Offline

 

#6 2012-07-30 10:06:45

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Stop Script when an event occurs.

Not sure if this will be of any use to you but I just wanted to mention that if you make a game over screen and then set it's ghost effect to 100 when the game starts it will show when stop all activates.


http://i50.tinypic.com/ded8m.png

Offline

 

#7 2012-08-02 13:44:19

dino6
Scratcher
Registered: 2009-11-07
Posts: 55

Re: Stop Script when an event occurs.

when gf clicked
forever if <touching [mouse-pointer v]>
  stop all


Hello, world!
http://news.bbcimg.co.uk/media/images/61749000/jpg/_61749765_minecraft.jpg

Offline

 

Board footer