Skip to content

Instantly share code, notes, and snippets.

@pr00thmatic
Created August 5, 2014 21:38
Show Gist options
  • Save pr00thmatic/127362bceb68c198b076 to your computer and use it in GitHub Desktop.
Save pr00thmatic/127362bceb68c198b076 to your computer and use it in GitHub Desktop.
cursores = game.input.keyboard.createCursorKeys();
if(cursores.left.isDown) {
...
} else if (cursores.right.isDown) {
...
} else if (cursores.up.isDown) {
uno.body.velocity.y = -1;
uno.animations.play('front')
lastDirection = 'front';
} else if (cursores.down.isDown) {
uno.body.velocity.y = 1;
uno.animations.play('back');
lastDirection = 'back';
} else {
uno.body.velocity.x = 0;
uno.body.velocity.y = 0;
uno.animations.play('stand_' + lastDirection);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment