Discuss Scratch

patrax6
Scratcher
1 post

Acceleration/Deacceleration

I would really like to know how to do this:

Upon starting, the car's acceleration is 0. When you press the w key, I want the car's acceleration to rise up to a value (let's say 10), then decrease to 0, where the speed of the car caps as acceleration is 0. So basically, changing the rate of change of the speed of the car to rise to a value, then decrease back to 0. Sorry if this doesn't really make sense, I'd be happy to explain further.
MultiTasker801
Scratcher
100+ posts

Acceleration/Deacceleration

the amount of acceleration you are applying while the user drives doesn't need to go down from maximum if you are applying friction as a coefficient on velocity

that is, each frame you set velocity = velocity * friction where friction is between 0 and 1

to determine top speed with this, use the following formula with a = maximum acceleration and f = friction
(a*f)/(1-f)

Powered by DjangoBB