Hello, i could use some help with a movement system, i need a way to make the players unit decelerate and then accelerate.
So far i have the basic idea of using left and right arrow keys to turn the unit, and up accelerates the unit in the facing direction (not exactly sure how to code that part). But the real problem I'm having is finding a way to have the unit say moving at 90 degrees, rotate to 270 degrees (still moving on the 90 but facing 270) then accelerate in the 270 direction. I need to have the unit to slow down till a speed of 0 is reached then pick speed up again.
The variables i've decided to use so far are:
speed (calculated by calculating acceleration and dividing by a constant to represent a game unit)
travelDirection (this is no longer calculated when the player releases the UP key, allowing the unit to then turn without causing the unit to move in a new direction (if using facing direction for movement))