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

#1 2012-02-04 16:30:58

haloman298
New Scratcher
Registered: 2011-09-03
Posts: 18

Vehicle Acceleration- How do you make a maximum speed?

I've already found a way to get a vehicle to accelerate, but how do you get it to not speed up any faster than a certain speed?  I'm using scrolling, so how do you do that?

Offline

 

#2 2012-02-04 16:38:50

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Vehicle Acceleration- How do you make a maximum speed?

Put the script that increases acceleration inside this:

if <(acceleration) < [max speed]>
<do stuff>
end

Last edited by Greenatic (2012-02-04 16:40:04)

Offline

 

#3 2012-02-04 16:49:06

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Vehicle Acceleration- How do you make a maximum speed?

if <accelerating?>
if <(acceleration) < (max speed)>
change [acceleration v] by ((acceleration) * (any number))
end
else
change [acceleration v] by (((acceleration) * (any number)) * (-1))
end
I fixed it and added to it.
You can replace (acceleration) * (any number) with (acceleration) / (any number).

Last edited by rdococ (2012-02-04 16:50:42)

Offline

 

#4 2012-02-04 16:58:42

haloman298
New Scratcher
Registered: 2011-09-03
Posts: 18

Re: Vehicle Acceleration- How do you make a maximum speed?

I've got it to work, somewhat.  At least the vehicle won't accelerate past a certain speed (instead of accelerating to a max speed of 20, it accelerates to a max speed of 22).

Offline

 

#5 2012-02-04 17:17:17

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Vehicle Acceleration- How do you make a maximum speed?

haloman298 wrote:

I've got it to work, somewhat.  At least the vehicle won't accelerate past a certain speed (instead of accelerating to a max speed of 20, it accelerates to a max speed of 22).

What script did you use?  Also, is there another script that could be affecting the acceleration?

Offline

 

#6 2012-02-04 17:35:01

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Vehicle Acceleration- How do you make a maximum speed?

I'm rather confused about what you are asking and the responses you've received.  Why not just stick this into the loop that deals with velocities?

if <(speed) > (10)>
     set [speed] to (10)
end

Last edited by MoreGamesNow (2012-02-04 17:35:56)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer