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

#1 2008-03-01 15:11:12

mankee34
Scratcher
Registered: 2008-02-27
Posts: 19

Help with the random buttons

Is there a way that I can give a Sprite a list of places to choose from that it can appear randomly? Thanks!

Offline

 

#2 2008-03-01 15:17:47

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Help with the random buttons

Yes you can. try this:
[blocks]

<when I receive[ change location
<set{ position }to( <pick random( 1 )to( 5
<if><( position <=> 1 )>
     <go to x sad  50 )y sad  -36
<end>
<if><( position <=> 2 )>
     <go to x sad  177 )y sad  60
<end>
<if><( position <=> 3)>
     <go to x sad  -123 )y sad  75
<end>
[/blocks]
and so on.

Hope that helped!

Last edited by JSO (2008-03-01 15:18:25)


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#3 2008-03-01 15:19:58

mankee34
Scratcher
Registered: 2008-02-27
Posts: 19

Re: Help with the random buttons

Thank you very much! That helped a lot

Offline

 

Board footer