A game with acceleration/deceleation

Discuss any other topics here
Post Reply
User avatar
zmaster
Posts: 28
Joined: Thu Nov 29, 2007 1:01 am

A game with acceleration/deceleation

Post 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? :?
free world

|-----------------|
0% 100%
User avatar
vrageprogrammer
Posts: 566
Joined: Wed Oct 31, 2007 2:59 pm
Location: On top of a tree
Contact:

Re: A game with acceleration/deceleation

Post 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
It was not Possible to determine the dimensions of the image....
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: A game with acceleration/deceleation

Post 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.
Herp derp.
User avatar
zany_001
Posts: 1047
Joined: Fri Mar 02, 2007 8:36 am
Location: Aotearoa

Re: A game with acceleration/deceleation

Post 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.
Once I was sad, and I stopped being sad and was awesome instead.
True story.
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: A game with acceleration/deceleation

Post 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.
Everyone can see the difficult, but only the wise can see the simple.
-----
Post Reply