This might get you started...
Drag (.98) keeps the ship from accelerating indefinitely (just like with Newtonian physics.) We apply a higher drag (.96) when the ship is turning to cause it to decelerate more.
Deciding which image to use is as easy as correcting the ship direction to 0-360, then dividing by 10 degrees per frame to get your frame index.
You'll probably want to tweak the functionality of the down arrow depending on current speed: it's a lot easier to brake than to drive in reverse! This may also apply to the up arrow if the player is going backwards. Also, you may want to lower the reverse deceleration: it's typically easier to go forwards than backwards, but this may depend on the type of ship.
You may also want to apply turning acceleration: in BF1942, when you turn a ship it takes a while to start turning, and continues turning after you let go. Nice touch for simulations, maybe not so nice for arcade games. Cobra Triangle would have been clumsy with that feature.
Graphics 800, 600 SetBuffer BackBuffer() Type ship Field x#, y# Field speed#, dir# End Type s.ship = New ship s\x = 400 s\y = 300 While Not KeyHit(1) Local turning = False If KeyDown(200) Then s\speed = s\speed + .01 If KeyDown(208) Then s\speed = s\speed - .01 If KeyDown(205) Then s\dir = s\dir - .3 : turning = True If KeyDown(203) Then s\dir = s\dir + .3 : turning = True If turning Then s\speed = s\speed * .96 Else s\speed = s\speed * .98 EndIf s\x = s\x + Sin(s\dir)*s\speed s\y = s\y + Cos(s\dir)*s\speed Cls Text 0, 0, s\speed Line(s\x, s\y, s\x+Sin(s\dir+170)*15 , s\y+Cos(s\dir+170)*15) Line(s\x, s\y, s\x+Sin(s\dir-170)*15 , s\y+Cos(s\dir-170)*15) Flip Wend End
Drag (.98) keeps the ship from accelerating indefinitely (just like with Newtonian physics.) We apply a higher drag (.96) when the ship is turning to cause it to decelerate more.
Deciding which image to use is as easy as correcting the ship direction to 0-360, then dividing by 10 degrees per frame to get your frame index.
You'll probably want to tweak the functionality of the down arrow depending on current speed: it's a lot easier to brake than to drive in reverse! This may also apply to the up arrow if the player is going backwards. Also, you may want to lower the reverse deceleration: it's typically easier to go forwards than backwards, but this may depend on the type of ship.
You may also want to apply turning acceleration: in BF1942, when you turn a ship it takes a while to start turning, and continues turning after you let go. Nice touch for simulations, maybe not so nice for arcade games. Cobra Triangle would have been clumsy with that feature.