Multiple sprites with animation

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.

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.