Quote:
Originally Posted by ploply
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