Last active
August 29, 2015 14:08
-
-
Save ekelokorpi/f57eb1025fbcb37b0c87 to your computer and use it in GitHub Desktop.
SpriteSheet: 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
// Creates spritesheet with frame size 138x100 | |
var spritesheet = new game.SpriteSheet('spritesheet.png', 138, 100); | |
// Returns sprite using frame 0 from spritesheet | |
var sprite = spritesheet.frame(0); | |
sprite.addTo(this.stage); | |
// Returns 15 frames long animation, starting from frame 2 | |
var anim = spritesheet.anim(15, 2); | |
anim.animationSpeed = 0.3; | |
anim.play(); | |
anim.addTo(this.stage); | |
// Define animation frames with array | |
var anim = spritesheet.anim([0, 0, 1, 2, 3, 2]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment