Created
November 20, 2017 07:10
-
-
Save writingdeveloper/4ae12dc2d231058cae595d3839521ad4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// KeyPress Settings | |
Player.prototype.handleInput = function(keyPress) { | |
if (keyPress == 'left') { | |
player.x -= player.speed; | |
} | |
if (keyPress == 'up') { | |
player.y -= player.speed - 20; | |
} | |
if (keyPress == 'right') { | |
player.x += player.speed; | |
} | |
if (keyPress == 'down') { | |
player.y += player.speed - 20; | |
} | |
console.log('keyPress is: ' + keyPress); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment