Jump to content

What's the proper way to change the sprite animation frames data?


jvalen
 Share

Recommended Posts

Hi there,

 

I have a 4x5(colums x rows) spritesheet. Each of this rows contains different animations applied to the same Sprite object, i.e:

this.load.spritesheet('body', 'assets/sprites/body.png', 80, 80);this.character = new Character(this.game, x, y, 'body');//Character class
var Character = function(game, x, y, spriteName) {
Phaser.Sprite.call(this, game, x, y, spriteName);
...

The Character class constructor create the default animations:

this.animations.add('walk', [0,1,2,0], 10, false);...

What I'm asking is for the best way (or just a way...) to update or change eventually the animation frames of a specific animation. For example to [12, 13, 14, 12].

I tried creating a new animation like:

this.animations.add('walk', [12, 13, 14, 12], 10, false);

but it doesn't seem to be working properly. I'm also tried to find a method to update the frame data (like animation.updateFrameData) no luck though.

 

What do you think about it?

 

Thanks!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...