Jump to content

add animation from range of frames


stasuss
 Share

Recommended Posts

Hello All,

 

In my game I use spritesheet with to rows. Each row contains 32 frames, 64 frames total. I need to define two animations.

 

The only way I see is to use 

sprite.animations.add('key', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, .......

Is this the only way, or does Phaser allows defining range of frames?

 

EDIT:

 

does Phaser support multirow spritesheets? I fail to use my spritesheet  :(

Link to comment
Share on other sites

Hi, yes there is defintely a better way to do it, there it is :

sprite.animations.add('key', game.math.numberArray(0,11),24,false);

You can also have a look at this function : http://docs.phaser.io/Phaser.Animation.html#generateFrameNames which is even more powerful.

 

Good luck

 

PS : and yes it should work with your spritsheet.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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