Shoot em up smooth player movement code?

Blitz3D Forums/Blitz3D Programming/Shoot em up smooth player movement code?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This should get you going the right direction. Typed straight into replybox, so, untested.
Const KEY_LEFT = 203
Const KEY_RIGHT = 205

Repeat
  cls
  If KeyDown(KEY_LEFT)
    xSpeed = xSpeed - 0.1
  EndIf
  If KeyDown(KEY_RIGHT)
    xSpeed = xSpeed + 0.1
  EndIf
  If not KeyDown(KEY_LEFT) and xSpeed < 0
    xSpeed = xSpeed + 0.1
  EndIf
  If not KeyDown(KEY_RIGHT) and xSpeed > 0
    xSpeed = xSpeed - 0.1
  EndIf
  if Abs(xSpeed) < 0.1
    xSpeed = 0
  endif
  If xSpeed < -5 then xSpeed = -5
  If xSpeed > 5 then xSpeed = 5
  x = x + xSpeed
  DrawImage ship,x,y
flip
Forever