Skip to content

Instantly share code, notes, and snippets.

@pr00thmatic
Last active August 29, 2015 14:04
Show Gist options
  • Save pr00thmatic/1b9485f9751ff898399a to your computer and use it in GitHub Desktop.
Save pr00thmatic/1b9485f9751ff898399a to your computer and use it in GitHub Desktop.
cursores = game.input.keyboard.createCursorKeys();
if(cursores.left.isDown) {
lastDirection = 'left';
uno.scale.x = -1;
uno.body.velocity.x = -1*velocity;
uno.animations.play('right'); //uno.scale.x=-1 hace que right se voltee a left
} else if (cursores.right.isDown) {
lastDirection = 'right';
uno.scale.x = 1;
uno.body.velocity.x = 1*velocity;
uno.animations.play('right');
} else {
uno.body.velocity.x = 0;
uno.animations.play('stand_' + lastDirection);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment