Skip to content

Instantly share code, notes, and snippets.

@ross-u
Last active October 10, 2019 12:09
Show Gist options
  • Save ross-u/e56058231f05455c870ac03742d74533 to your computer and use it in GitHub Desktop.
Save ross-u/e56058231f05455c870ac03742d74533 to your computer and use it in GitHub Desktop.
JS | Canvas API - Space Pacman

JS | Canvas API


'Space' Pacman - Exercise


Using the previous Codepen canvas example with the Pacman ghost, we will try to add an additional event listener.

Some time during the game we may want to restart everything, putting the ghost on it's initial position.

Let´s do it using the spacebar key.

When somebody clicks on the spacebar our ghost should return to the position (50,50).

Go ahead and add the functionality in the Codepen.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment