Jump to content

Best practice for using emitters, re-use or create new?


BdR
 Share

Recommended Posts

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

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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