Created
October 24, 2014 13:07
-
-
Save ekelokorpi/ae1217de4a7755ad2072 to your computer and use it in GitHub Desktop.
Keyboard: Basic usage
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
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