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

#1 2010-02-28 09:09:03

Dominoman
Scratcher
Registered: 2010-02-27
Posts: 13

Switch

You could add a switch variable that comes with a button to press that turns it on or off, and have new blocks such as "If switch 1 on = True" and so on.


Dragons-The RPG: Tales & Tails
http://scratch.mit.edu/galleries/view/89238  big_smile

Offline

 

#2 2010-02-28 09:23:13

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

Re: Switch

Easy:

1) make a button sprite

2) script (in button sprite)
when sprite clicked
set [ switch ] to [ ( 1 - ( switch ) ) ]

3) if < switch 1 on > = if < ( switch ) = ( 1 ) >

Offline

 

#3 2010-02-28 09:55:09

Dominoman
Scratcher
Registered: 2010-02-27
Posts: 13

Re: Switch

Thanks!  smile


Dragons-The RPG: Tales & Tails
http://scratch.mit.edu/galleries/view/89238  big_smile

Offline

 

#4 2010-03-01 23:53:34

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: Switch

By setting a variable to either 0 or 1 to be false or true, we can use this:
<repeat( x )]
|
<end>
Instead of what we could do if there were boolean variables:
<if><( x )>
|
<end>

Last edited by billyedward (2010-03-01 23:54:17)


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

Board footer