BdR Posted July 11, 2017 Share Posted July 11, 2017 Question about using emitters in Phaser and what is the best practice for perfomance and memory use. Let's say a typical game where the player collects coins and occasionally there is a bomb. Whenever the player collects a coin there appear a few (like 3 or 4) particles, when a bomb explodes there are different type particles and when the player dies a few star particles appear. A typical game probably has more, but just as an example here it's three different particle effects. What would be the best way to handle this in Phaser? 1. create three emitters at start of game, reuse same three throughout game 2. create one emitters for coin particles and reuse throughout game, and create new bomb/stars emitters as needed 3. create new emitters for each instance that particles are needed About that 3rd option, I figure that will take a toll on memory usage because emitters don't auto-destroy once they are finished. So would you need to destroy them manually, and if so how? Or is creating many emitters just not a good idea at all? I'd love to hear any ideas or best practices on this. Link to comment Share on other sites More sharing options...
samme Posted July 12, 2017 Share Posted July 12, 2017 (1) is best. You rarely need multiple emitters (of the same type) unless you're running multiple particle flows at different locations at the same time. Link to comment Share on other sites More sharing options...
Recommended Posts