Skip to content

Instantly share code, notes, and snippets.

@writingdeveloper
Created November 20, 2017 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save writingdeveloper/242aa9f8d965994a8aa253150c0b4910 to your computer and use it in GitHub Desktop.
Save writingdeveloper/242aa9f8d965994a8aa253150c0b4910 to your computer and use it in GitHub Desktop.
// This listens for key presses and sends the keys to your
// Player.handleInput() method. You don't need to modify this.
document.addEventListener('keyup', function(e) {
var allowedKeys = {
37: 'left',
38: 'up',
39: 'right',
40: 'down'
};
player.handleInput(allowedKeys[e.keyCode]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment