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

#1 2012-06-05 13:30:46

paul2978
New Scratcher
Registered: 2012-05-31
Posts: 13

Reset Button

HI All Again  tongue

I would like to create a reset button, so all characters return to their original starting positions. However I cant seem to get the scripts to allow anything.

Id like something like:

WHEN button CLICKED
             MOVE sprite1 AND sprite2
             TO X:0 and Y:0

any advice?

Thanks

Paul

Offline

 

#2 2012-06-05 13:34:34

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Reset Button

Try this:

For the button:

when button clicked
broadcast [reset v]
For Sprite1:
when i receive [reset v]
go to x: (0) y: (0)
For Sprite2:
when i receive [reset v]
go to x: (0) y: (0)

Last edited by SciTecCf (2012-06-05 13:35:18)


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&display=small

Offline

 

#3 2012-06-05 13:37:19

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: Reset Button

That should work, a broadcast.


Why are the secret organizations getting all the attention?  mad

Offline

 

#4 2012-06-05 13:42:52

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Reset Button

Or you can use variables:

Button:

when gf clicked
set [reset v] to [0]
forever
 wait until <<mouse down?> and <touching [mouse-pointer v]?>>
 set [reset v] to [1]
 wait until <<not <mouse down?>> or <not <touching [mouse-pointer v]?>>>
end
Sprite1:
when gf clicked
wait until <(reset) = [0]>
forever
 wait until <(reset) = [1]>
 go to x: (0) y: (0)
 wait until <(reset) = [2]>
 set [reset v] to [0]
end
Sprite2:
when gf clicked
wait until <(reset) = [0]>
forever
 wait until <(reset) = [1]>
 go to x: (0) y: (0)
 set [reset v] to [2]
end


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#5 2012-06-11 18:39:58

auntiechristine
Scratcher
Registered: 2012-05-23
Posts: 14

Re: Reset Button

Is it generally better (more efficient, less likely to slow scripts down, etc) to use broadcast for things like this, or variables?

Offline

 

#6 2012-06-11 18:47:38

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Reset Button

auntiechristine wrote:

Is it generally better (more efficient, less likely to slow scripts down, etc) to use broadcast for things like this, or variables?

Its better to use broadcasts, variables can get a bit clumsy.


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

Board footer