Jump to content

Multiple sprites with animation


darkraziel
 Share

Recommended Posts

Hello everyone. I'm currently working in a Puzzle Bubble kind of game and I'm trying to improve mobile performance.

 

Currently I'm creating 1 pool for each colored bubble in my game and adding all animation frames to the sprite like this:

this.redBubbles = this.game.add.group();this.redBubbles.createMultiple(BUBBLE.AMOUNT_NORMAL, "anim_bubbles", "anim_red1_0.png");this.redBubbles.callAll("animations.add", "animations", "start", ["anim_red1_0.png"]);this.redBubbles.callAll("animations.add", "animations", "over", ["anim_red_over.png"]);frameNames = Phaser.Animation.generateFrameNames("anim_red2_",0, 10, ".png");this.redBubbles.callAll("animations.add", "animations", "kill", frameNames);frameNames = Phaser.Animation.generateFrameNames("anim_red1_", 0, 6, ".png");this.redBubbles.callAll("animations.add", "animations", "collision", frameNames);

As I need to use them I just change the visible property to true and kill them when I stop using them.

 

Is this the correct way to use sprites and animations? Would it be better to just create a pool of sprites without animations and create a new sprite on top of it to animate?

 

Thanks for any help and excuse the poor english.

Link to comment
Share on other sites

I had some performance problems and was trying to find out what was causing it. Since I had a lot of sprites on screen I thought that maybe this method wasn't the best, though it seems the problem was elsewhere.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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