Workshop › Endless Runner › Step 7 of 19

Tap to jump

What we are doing

On a phone there is no Space key. Pressing on the canvas jumps and lifting the finger ends the jump, just like the key.

```js
canvas.addEventListener('pointerdown', jump)
canvas.addEventListener('pointerup', endJump)
```

What it means

Your turn

Under the keyup listener, write the two lines.

Skills: Keyboard and mouse input

All steps

  1. The ground
  2. The runner
  3. Draw again and again
  4. Gravity
  5. Jump
  6. Short hops
  7. Tap to jump
  8. Things that come at you
  9. Cacti keep coming
  10. Wait for the start
  11. Crash
  12. Try again
  13. Faster and faster
  14. Remember the best run
  15. The score counter
  16. Birds
  17. Which keys are down?
  18. Duck
  19. Build it yourself: jump buffering