accelerations/deceleration code

Blitz3D Forums/Blitz3D Programming/accelerations/deceleration code

Craig H. Nisbet(Posted 2009) [#1]
I know i've done this before but I always seem to forget the code for it. I'm trying to write a game that uses the keys for a controller. I'm trying to make my entity move in a smooth motion accelerating and decelerating like main ship in asteroids. Anyone have the code for this?


Ross C(Posted 2009) [#2]
You could multiply the speed by 1.001 or whatever values suits when accelerating, and when no key is pressed, multiply the speed by 0.99.

Other than that, you could make use of SIN/COS to produce curves for accelerating and decelerating.


Stevie G(Posted 2009) [#3]
Here's some code I posted in a similar thread a while back:

http://www.blitzbasic.com/Community/posts.php?topic=44999#500732


Ross C(Posted 2009) [#4]
Some interesting stuff there Stevie.