Jump to content

Emitters - custom sprite class for particle effects?


Mariusz
 Share

Recommended Posts

Hello guys. 

I'm trying to create an explosion effect in my game and the following is my approach to the problem. The explosion consists of one explosion particle, several smoke particles and some sparkle particles. Thus I'm thinking of having three emitters. 

 

So good so far. However, I'd like the particles to animate in some ways, e.g. diminish and fade out smoothly rather than having them disappear after a certain interval. I've looked into Phaser and tried to set my custom sprite class to the particleClass property in the Emitter function, to no avail.

 

Iterating over the group and setting a tween to each child doesn't seem like an option, since that would interfere with other particles emitted in another place in the game. 

What's the 'proper' approach to the problem? Thanks in advance.

Mariusz

Link to comment
Share on other sites

Try fading the particles with a timer inside a function. That way you can have a wait period then update into a fade without tweens. I use alpha += 0.01 for fading inside my update but you can play with that if needed. If you have other particles that don't require the fade then set the alpha back to normal after the fade is complete. A quick if statement on the particles in update to set that back up and it should work fine. Its what I would do anyway.

Hope this helps :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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