Skip to content

Instantly share code, notes, and snippets.

@ada-lovecraft
Created April 11, 2014 18:52
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 ada-lovecraft/10491955 to your computer and use it in GitHub Desktop.
Save ada-lovecraft/10491955 to your computer and use it in GitHub Desktop.
Animation
var sprite = game.add.sprite(x, y, 'spriteSheet');
sprite.animations.add('idle', [3]);
var spriteAnimation = sprite.animations.add('jump', [0,1,2,3,2,1]);
spriteAnimation.onComplete.add(animationStopped, this);
sprite.play('jump');
function animationStopped() {
sprite.play('idle')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment