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

#1 2013-03-07 12:02:33

nommer
New Scratcher
Registered: 2013-03-07
Posts: 2

Movement Chance Script?

Hi Scratch Community.  smile
So, I have a homework assignment to make a water ride in Scratch. I want too add a nifty feature, but I'm not too sure on how I'll get around to doing it.
First, please check out the project here.
You might notice the little green lane with the little white dot sprite next to it. What I want to happen is that every time the boat sprite comes close (or touches) to the emergency broadcast sprite, it selects a random number. If the number it chooses is 1 or 2, it moves down the green lane and the all the scripts stop. But if it selects 3-10, it keeps going on as normal. I have tried doing this, but so far it has failed.
Any idea? Help would be appreciated.
Any suggestions on how to improve my water ride would also be awesome!  big_smile

Offline

 

#2 2013-03-07 12:17:55

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Movement Chance Script?

Okay, the only way i can think of right now is... Oh wait, maybe you could use lists?

I have never used lists before, but basically, try adding 1 and 2 to a list, and then 3-10 to a list. Then you can have it check which list the number is in and that might work...

Tell me if that makes sense and i it works.

Regards,

CAA14

Offline

 

#3 2013-03-07 12:31:59

Nomolos
Scratcher
Registered: 2011-07-29
Posts: 1000+

Re: Movement Chance Script?

Here you go nommer! I added what you wanted so now every time the boat passes the white dot, it picks a random number and goes wherever the number tells it to!

Last edited by Nomolos (2013-03-07 12:32:03)


Goodbye 1.4. I'll always remember you and treasure your awesomeness in my heart.
RIP 1.4: 2007-2013 *Sniffles* *Sobs* *Bursts into tears*

Offline

 

#4 2013-03-07 12:45:06

nommer
New Scratcher
Registered: 2013-03-07
Posts: 2

Re: Movement Chance Script?

Nomolos wrote:

Here you go nommer! I added what you wanted so now every time the boat passes the white dot, it picks a random number and goes wherever the number tells it to!

Thank you so much, exactly what I was looking for.
It has a 1/4 chance of going down the emergency lane, yay!  big_smile

Offline

 

#5 2013-03-07 12:48:46

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: Movement Chance Script?

Well, glad you were helped.

Regards,

CAA14

Offline

 

Board footer