I am writing a top-down 2d game, in which the player can control an airplane via the WASD
keys. The W
key should move the plane upwards (north), the A
key to the west, and so on.
Now I need a simplified aerodynamics model to control the flight direction and speed of the plane. Pressing W
should accelearte the plane a bit to reach full speed, then while the player continues to press W
the plane should continue to move upwards on the screen (remember, top-down view).
When the player releases the W
key and presses the D
key now, the plane should behave similar to the real world. That is, it must not immediately move to the right (east), instead it should continue to fly to the north, but gradually start to move to the east. Then if the player continues to press the D
key, the plane eventually has to fly solely to the east. So all in all in this example the airplane has to fly a curve from north to east.
In general the plane must not change its direction immediately and directly when the player presses another key, but instead fly using a simplified inertia (?) model. This should of course also work correctly if the player presses two keys at the same time, for example W
(north) and A
(west).
How would I achive this general in a 2d top-down game?