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

#1 2013-03-09 13:22:21

Glenjy
New Scratcher
Registered: 2013-03-09
Posts: 2

Random Decisions

I'm building a game, involving a sprite that travels through tunnels, randomly picking a different tunnel when it comes to a fork in the road each time. Is there any way to code the sprite so that it picks randomly?

Offline

 

#2 2013-03-09 13:45:29

OrcaCat
Scratcher
Registered: 2010-06-30
Posts: 500+

Re: Random Decisions

Yes.

when gf clicked
forever
if <touching [fork v]?>
broadcast [change tunnel v]
end
end
when i receive [change tunnel v]
switch to costume (pick random (1) to (number of costumes))
go to [start of tunnel v]
Good luck!

Last edited by OrcaCat (2013-03-09 13:46:20)


     Awesome music     Electrode's theme     Epic music
Bye, 1.x.  sad                             Hello, 2.x!  smile

Offline

 

#3 2013-03-09 14:00:37

Glenjy
New Scratcher
Registered: 2013-03-09
Posts: 2

Re: Random Decisions

Thanks!

Offline

 

#4 2013-03-09 14:59:53

OrcaCat
Scratcher
Registered: 2010-06-30
Posts: 500+

Re: Random Decisions

Glenjy wrote:

Thanks!

Welcome  smile


     Awesome music     Electrode's theme     Epic music
Bye, 1.x.  sad                             Hello, 2.x!  smile

Offline

 

Board footer