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.