Jump to content

multiple particles emitters


kiwi
 Share

Recommended Posts

hi,

 

in my game I'm dropping bombs from an airplane, and when a bomb hit the ground I create an emitter particle at given position. When the bomb hit the ground I load another bomb on the plane and create another emitter.

 

My questions are:

 

1. are emitter auto destroy once completed the animation?

2. is there a way to optimise this using only one emitter but having the full animation in place?

 

thanks

 

 

Link to comment
Share on other sites

Nope, emitters don't auto destroy. You'd probably be better off re-using the first emitter or setting up a system where you have a pool of emitters. Sticking the emitters in a group and using "getFirstDead" might be a good start.

thanks, but once I get the reference I just have to trigger the start method? I saw the update() method on the documentation but it's not very clear what it does?

 

 

can I use it like this?

this.bombEmitter = []; this.bombEmitter.length === 0 && this.bombEmitter.push(this.game.add.emitter(0, 0, 30));var bombEmitter = this.bombEmitter[0] 

thanks

Link to comment
Share on other sites

thanks, but once I get the reference I just have to trigger the start method? I saw the update() method on the documentation but it's not very clear what it does?

 

 

can I use it like this?

this.bombEmitter = []; this.bombEmitter.length === 0 && this.bombEmitter.push(this.game.add.emitter(0, 0, 30));var bombEmitter = this.bombEmitter[0] 

thanks

 

I'll quote myself.

 

I was using the code above and after that updating some properties such as alpha values and position but it was causing me some blocking errors.

To fix this I simply call the kill method before start (please let me know if it's not the correct way or there is a better way to do it so)

 

the final code:

this.bombEmitter.length === 0 && this.bombEmitter.push(this.game.add.emitter(0, 0, 30));var bombEmitter = this.bombEmitter[0]bombEmitter.kill();bombEmitter.gravity = 0;bombEmitter.setXSpeed(-200, 200);bombEmitter.setYSpeed(-200, 200); // make smoke drift upwardsbombEmitter.setAlpha(1, 0, 1000, Phaser.Easing.Linear.InOut);bombEmitter.makeParticles('star');//add to the ground group so it will following during scrollground.addChild( bombEmitter)bombEmitter.start(true, 1000, 50, 15);
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...