View Full Version : Car speed up over time?
dubastot
06-16-2009, 11:51 AM
:confused:How do you make a car speed up over time?
ploply
06-16-2009, 03:11 PM
:confused:How do you make a car speed up over time?
Set duration to begin gently.
ploply
ttkrakus
06-17-2009, 11:36 PM
Set duration to begin gently.
ploply
This will work for when the car first starts moving, but if you want acceleration, then you need something else. Let's start with velocity.
Velocity is usually represented as unit-of-distance over unit-of-time, like miles/hour, for example.
So, if you use the 'move' method with a *fixed* duration to make the car move, then by increasing the value of the argument 'amount' will make the car looks as it is moving faster (it is covering more distance in the same amount of time)
So, what to do.
Declare a Number variable for the car object; call it 'velocity' --somewhat misleading, but it will do the trick.
Use this variable as the argument 'Amount' for the 'move' method of the car object.
If you want the speed of the car to change by pressing certain keys, then define two 'When a Key is pressed' events (say, one for the + key to increase the speed, and one for the - key to decrease it). Increase (decrease) the value of the variable 'velocity' by a fixed amount every time the event for increasing (decreasing) the speed is triggered.
If you just want the car to accelerate by itself, you could have a little loop with two tiles: one in which you increase the value of variable 'velocity', and the other for moving the car using 'velocity' as the 'Amount' argument.
Hope this helps
dubastot
06-19-2009, 06:38 PM
This will work for when the car first starts moving, but if you want acceleration, then you need something else. Let's start with velocity.
Velocity is usually represented as unit-of-distance over unit-of-time, like miles/hour, for example.
So, if you use the 'move' method with a *fixed* duration to make the car move, then by increasing the value of the argument 'amount' will make the car looks as it is moving faster (it is covering more distance in the same amount of time)
So, what to do.
Declare a Number variable for the car object; call it 'velocity' --somewhat misleading, but it will do the trick.
Use this variable as the argument 'Amount' for the 'move' method of the car object.
Hope this helps
So I make a method where car move 5m in 10secs and then car move 5m in 9secs and then car move 5m at 8secs...????
So