Skip to content

Instantly share code, notes, and snippets.

@ekelokorpi
Created October 24, 2014 13:07
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 ekelokorpi/ae1217de4a7755ad2072 to your computer and use it in GitHub Desktop.
Save ekelokorpi/ae1217de4a7755ad2072 to your computer and use it in GitHub Desktop.
Keyboard: Basic usage
game.createScene('Main', {
keydown: function(key) {
if (key === 'SPACE') {
// Space key down
}
},
keyup: function(key) {
if (key === 'SPACE') {
// Space key up
}
},
update: function() {
// Check if key is currently down
if (game.keyboard.down('SPACE')) {
// Space is down
}
this._super();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment