Page 1 of 1

A game with acceleration/deceleation

Posted: Sat Feb 23, 2008 6:05 pm
by zmaster
How would I make a game where the actor accelerates to a 30 and deceleates to a speed of -6 or so and make it so he can skid? :?

Re: A game with acceleration/deceleation

Posted: Sun Feb 24, 2008 6:38 am
by vrageprogrammer
Possible.

Hust check for input(i.e, Acceleration key)

If key is down, accelartion = accelaration + 1
If key is NOT down, acceleration = acceleration -1

Re: A game with acceleration/deceleation

Posted: Sun Feb 24, 2008 6:46 pm
by darksmaster923
vrageprogrammer wrote:Possible.

Hust check for input(i.e, Acceleration key)

If key is down, accelartion = accelaration + 1
If key is NOT down, acceleration = acceleration -1
the main problem with that is that the script commands applied everything too fast. that would make the acceleration to a complete stop.

Re: A game with acceleration/deceleation

Posted: Tue Feb 26, 2008 6:38 pm
by zany_001
Either make the max acceleration something like 2 million, or use wait commands to make it take longer between acceleration.The second one could make it have blocky acceleration though.

Re: A game with acceleration/deceleation

Posted: Thu Feb 28, 2008 1:44 pm
by Jay
Or use DeltaTime values:

ACC_SPEED [1] //+1 acc per sec
DELTA_TIME [0]
LAST_TIME [0]
ACCELERATION [0]

DELTA_TIME=self.time-StringCopy(LAST_TIME); //time passed by since last frame
ACCELERATION=StringCopy(ACCELERATION)+StringCopy(ACC_SPEED)*StringCopy(DELTA_TIME);
LAST_TIME=self.time;

This way you have a smoth transition which does not depend on the frame rate. You can also easily set the ACC_SPEED to other values during runtime, for example -1 to lower the speed.