; Moving a ship with the keyboard Graphics 640, 480 SetBuffer BackBuffer() x = 300 : y = 400 speed = 5 r = 90 : g = 200 : b = 255 While Not KeyHit(1) ; arrow keys: held down = keep moving If KeyDown(203) Then x = x - speed ; left If KeyDown(205) Then x = x + speed ; right If KeyDown(200) Then y = y - speed ; up If KeyDown(208) Then y = y + speed ; down ; space: pressed once = one change If KeyHit(57) Then r = Rand(50, 255) : g = Rand(50, 255) : b = Rand(50, 255) ; stay on the screen If x < 0 Then x = 0 If x > 600 Then x = 600 If y < 0 Then y = 0 If y > 450 Then y = 450 Cls Color r, g, b Rect x, y + 10, 40, 20 ; body Rect x + 15, y, 10, 10 ; cockpit Color 255, 140, 0 Rect x + 5, y + 30, 6, 6 ; flames Rect x + 29, y + 30, 6, 6 Color 255, 255, 255 Text 10, 10, "Arrows move, Space changes colour, Escape quits" Flip Wend End