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

#1 2009-02-13 15:42:17

Hyracuese
Scratcher
Registered: 2009-02-13
Posts: 1

How to randomise movement

hi
i was wondering how i could randomise the movements of my ghost on my pac-man game so when the hit a wall the randomly pick a direction to go

Offline

 

#2 2009-02-13 16:02:52

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

Re: How to randomise movement

You have a script for turning when hitting a wall already, right?
It should be like...

<if><touching[ wall
  <move( -5 )steps>
  <turn cw( 90 )degrees>
<end>[/blocks]

Change the
<turn cw( 90 )degrees>[/blocks]
to
<if><( <pick random( 0 )to( 1 <=> 0 )>
  <turn cw( 90 )degrees>
<else>
  <turn ccw( 90 )degrees>[/blocks]

Offline

 

#3 2009-02-15 13:04:43

sailorgrl
Scratcher
Registered: 2009-02-07
Posts: 20

Re: How to randomise movement

I radomized the movements of a sprite in my program, but if it receives something that says hide it won't go away. What shouId I do? 
SAILORGRL

Last edited by sailorgrl (2009-02-15 16:49:30)

Offline

 

#4 2009-02-15 16:45:10

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

Re: How to randomise movement

sailorgrl wrote:

I radomized the movements of a sprite in my program, but if it receives something that says hide it won't go away. What shouId I do? 
SAILORGRL

Would it possible for you to Share a the project you would like fixed?  It's much easier to figure out what is wrong if we can see the project.


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

Offline

 

#5 2009-02-15 16:52:34

sailorgrl
Scratcher
Registered: 2009-02-07
Posts: 20

Re: How to randomise movement

Here is my project (sprite 9 is the sprite I am having troubles with!) http://scratch.mit.edu/projects/sailorgrl/417981
Thanks for your help!

Offline

 

Board footer