Sign in to follow this  
jamessimo

Emitter particles following parent

Recommended Posts

Hey guys, I have 2 questions. 

1. Why can't a particle emitter follow a sprite using trackSprite?  

emitter.trackSprite(player, 48, 24); 

2. Currently my emitter follows the parent (player) by setting the emitters position on every step as mentioned here http://www.html5gamedevs.com/topic/5549-anchor-emitter-to-sprite/
The problem is that all the particles follows my sprite after it is emitted. I have attached the exact code I used below.  I don't want the emitted to share their local coordinates with the emitter after it has been fired. 

//Called every time my character shoots a weapon. 
emitter.position.x = player.position.x;
emitter.position.y = player.position.y;
emitter.start(true, 1000, 500, 1, true);

 

Share this post


Link to post
Share on other sites

It could, but emitters don't have that function. I'm pretty sure you could get the functionality you want by making the emitter a child of the player: "player.addChild(emitter);" Then it's positioned relative to the player, so you could add it at (0,0) and forget about it.

That said, if this emitter is for bullets you should check out the Phaser.Weapon plugin built-in to Phaser. It handles *a lot* of this stuff for you. But if you're asking about "trackSprite" you probably already looked at Weapon, so... ( =

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.