Jump to content

Problem with emitter and maxParticles


totallybueno
 Share

Recommended Posts

Hi there,

so I have my game and everything is working but I have this weird behavior, probably is something obvious and I´m missing something, sorry if that´s the point...

 

Well, basically, the idea is that I have a emitter shooting missiles (3) and I set the .maxParticles to 3. The first time it shoots, it shoots 3 missiles, good for me!

emitter.maxParticles=3;

and I start that emitter with

emitter.start(false, 2000, 100, 3);

I check in the update() if one of the missiles hits the target and call this callback and I destroy that missile (I also tried kill() at first)

ihityou:function(yourtarget, missile){   //DO SOME STUFF   missile.destroy();},

The problem is that the next time that I´m launching 3 missiles, the emitter is launching 6, and then 9, and then 12... to launch again, I´m using the same code that the first time...

emitter.start(false, 2000, 100, 3);

I tried the forceQuantity parameter in the start() (the fifth one) and yes, the emitter is launching just 3 missiles, but it seems that sets the first parameter to true and it launches all the missiles at the same time instead of with the frequency that I set before (100 ms.)

 

Can anyone tell me what is happening here? I don´t know how to fix this and I guess it´s basic stuff... Thanks in advance.

Link to comment
Share on other sites

I know this doesn't quite answer your question... but if you're firing three missiles you could create the sprites yourself? Since that would get you unblocked and let you get on with your game?

 

And, just guessing, but reading the code for the Arcade Emitter (that's the one you're using?) start method, if you're passing a truthy value to forceQuantity then yes, it's like an explode.

 

Try setting the fourth parameter to 0. That should emit maxParticles and then stop.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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