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

#1 2013-03-16 13:28:16

lorenzobarzon
New Scratcher
Registered: 2013-03-16
Posts: 2

Moto casuale - random motion

Salve,
devo realizzare uno script in cui il personaggio si muove casualmente verso Nord Est sud Ovest e si muove di 10 passi alla volta. Chiedo aiuto. Grazie

Hi,
I have to make a script where the character moves randomly to the north east south west and moves 10 steps at a time. I ask for help. thanks

Offline

 

#2 2013-03-16 15:07:53

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Moto casuale - random motion

lorenzobarzon wrote:

Salve,
devo realizzare uno script in cui il personaggio si muove casualmente verso Nord Est sud Ovest e si muove di 10 passi alla volta. Chiedo aiuto. Grazie

Hi,
I have to make a script where the character moves randomly to the north east south west and moves 10 steps at a time. I ask for help. thanks

Okay, well here's a script that you could use:

when gf clicked
forever
 set [random v] to (pick random (1) to (4))
 if <(random) = (1)>
  change x by (-10)
 else
  if <(random) = (2)>
   change x by (10)
  else
   if <(random) = (3)>
    change y by (10)
   else
    change y by (-10)
   end
  end
 end
 wait (.001) secs//Optional Delay

I hope that this helps!

Also, salve lorenzobarzon! Welcome to Scratch! I wish you a wonderful time here!

With regards,

ErnieParke

Last edited by ErnieParke (2013-03-16 15:08:09)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer