Sign in to follow this  
Mariusz

Emitters - custom sprite class for particle effects?

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

Share this post


Link to post
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 :)

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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.