darkraziel Posted July 31, 2015 Share Posted July 31, 2015 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 More sharing options...
darkraziel Posted August 3, 2015 Author Share Posted August 3, 2015 bump ~ Link to comment Share on other sites More sharing options...
drhayes Posted August 3, 2015 Share Posted August 3, 2015 Are you having any problems while doing this? It's hard to tell without more context but that seems okay to me. You can then grab new ones by calling the group's getFirstDead method. Link to comment Share on other sites More sharing options...
darkraziel Posted August 4, 2015 Author Share Posted August 4, 2015 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 More sharing options...
Recommended Posts