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

#1 2009-04-05 02:44:56

bando
Scratcher
Registered: 2008-07-18
Posts: 10

I Don't Know Anything About Numbers Or Variables!!!

Please tell me what numbers and variables do and what they mean???! I might need to use them!!!  hmm   hmm   cool

Offline

 

#2 2009-04-05 06:48:52

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: I Don't Know Anything About Numbers Or Variables!!!

There's a forum topic that talks about them here,

http://scratch.mit.edu/forums/viewtopic.php?id=1653

Hopefully that will give you some idea of how they are used.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2009-04-05 13:14:47

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: I Don't Know Anything About Numbers Or Variables!!!

Well lets do an example of a spinner (We're talking about numbers here.)

[blocks
Spin button:
<when[ spin clicked
<broadcast[ Spin

Spinner
<when I receive[ spin
<turn cw( <pick random( 1)to( 360
[/blocks]

Oh yeah if you ARE doing a spinner then make sre the spinner is the arrow of the spinner then do a background with the numbers/colours on it.


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#4 2009-04-05 14:50:27

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: I Don't Know Anything About Numbers Or Variables!!!

Now, a example for variables.

[blocks]For this example we'll use a "Score" variable. Comments are in blue.

Let's say everytime you click Sprite1 you get a point.

<when green flag clicked>
<set{ Score }to( 0 -- First it resets the score
<forever>
<wait( 0.5 )secs> -- Does this every 0.5 seconds
<go to x sad  <pick random( -240 )to( 240 )y sad  <pick random( -180 )to( 180 -- Goes to a random position
<end>

<when[ Sprite1 ]clicked>
<change{ Score }by( 1 -- When clicked, gives a point
<go to x sad  <pick random( -240 )to( 240 )y sad  <pick random( -180 )to( 180 -- Goes to a random position to make sure you don't cheat[/blocks]

That's my short lesson on Variables. You also might want to read my E-Book on it: link And also my E-Book on Scratch Math: link

Hope that helped!  wink

Last edited by technoguyx (2009-04-05 14:51:15)


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

Board footer