Game Dev From Zero · Episode 6

Drive the ghost

Arrow keys or WASD (or the buttons) to move. The ghost is moved by exactly the lines on the right: every frame, each if asks its question, and the line lights up when the answer is yes.

The game 320 × 180, like PALE WHISPERS

position (x, y)
(160, 90)
moving at
0 px/s

The code tick = on

Things to try

  1. Untick if left is held. Now try going left.
  2. Untick the edge checks (the last four) and walk off the screen. Where's the ghost now?
  3. Hold right and watch "moving at". Then hold right + down. Faster?! Why? (Episode 7!)
  4. Set the speed to 200. Then 20. It's pixels per second, thanks to delta time.