Stephen Kennedy
Stephen Kennedy

Reputation: 549

Create JS Spritesheet, for some reason displaying the first frame

in the below 'walkleft' animation I'm declaring frames 4,5,6 and 7 but when I slow it right down using speed:0.1 to see what is going wrong, I can see it is for some reason displaying frames 1, 4, 5, 6 and 7. Is my syntax wrong? Is this a common issue with CreateJS spritesheets? Any help appreciated.

var data = 
 {
 images: ["images/male_hero.png"],
 frames: {width:32.4, height:49},
 animations: {walkleft:
              {
              frames:[4,5,6,7, "walkleft"],
              speed:0.1
              }
              , walkright:[9,12,"walkright"]}

 };
 var spriteSheet = new createjs.SpriteSheet(data);

Upvotes: 0

Views: 33

Answers (1)

Stephen Kennedy
Stephen Kennedy

Reputation: 549

Managed to fix the issue.

 var data = 
 {
 images: ["images/male_hero.png"],
 frames: {width:32.4, height:49},
 animations: 
    {
        // start, end, next, speed
        walkleft: [4,7,"walkleft",0.08],
        walkright: [8,11,"walkright",0.08]
    }

Thanks

Upvotes: 1

Related Questions