I'm trying to get a sprite to animate and flip depending on which key I press (move left, move right).
Right now the sprite is appearing on screen, but the sprite isn't animating correctly... Following the sprite sheet, frames 0-9 should be him walking left, and 10-19 should be him walking right.
I try to achieve that with:
spriteSheet = new createjs.SpriteSheet({
images: [imgMonsterARun],
frames: {width: 64, height: 64, regX: 32, regY: 32},
animations: { walk_left: [0, 9], walk_right: [10, 19]
}
});
Also, he should flip around depending on which key I hit, left or right. I thought I was doing that with
if (key == left) {
bmpAnimation.gotoAndPlay("walk_left");
and
if (key == right) {
bmpAnimation.gotoAndPlay("walk_right");
But those just switch him around, but don't play remainder of animation frames.
Thanks