Jump to content

Showing/Staying at particular animation indices


Meowts
 Share

Recommended Posts

Hey!

 

I'm a newbie game developer, and for start I just want to say that Phaser is providing me an excellent way to get into game development!!

 

So, I have a spritesheet with images that I'd like to have showing under certain conditions. I'm achieving that by defining a bunch of single frame 'animations' that are being called to play when the conditions are met. I'm alright with this, but I'm wondering for efficiency sake if there's a way to just define a single animation, and then say something like:

if(condition1){animation.play('anim', [1], 10);animation.stop();}if(condition2){animation.play('anim', [2], 10);animation.stop();}

I realize the play function doesn't take in the frame index value, but is there another approach I could take here? Am I over-thinking it? Thanks for any tips!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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