Hello all,
after lurking for a while, here it goes a question...
I'm using
@GregBug particles system and it works just fine when I show a single emitter, but I don't know how to use it in a game where many emitters are working at the same time, ie: in a game where you shoot enemies and many explosions are displayed on screen at the same time. I've tried to create an array with as many emitters I think will be on screen at the same time, and before doing an emitter:setPosition(x,y) and emitter:start() I go through the array and check if not arrayfx[n]:started() but it doesn't work very well. Am I approaching this in the wrong way ?
Comments
I was having the problem of assigning the emitter to self. It should be to stage instead.
In the ball class, the line : self.emitter = CEmitter.new(0,0,0,stage)
I'm sorry I don't have time now to put a dummy project together, try this (not tested, could be worthless... :-\" ):
P.s.
I would try to avoid continuous onEnterFrame check: I don't know what do you have in mind, this could be right or wrong depending on your specific needs and situation:
if you dispatch a "personalized" event to your ball for every hit it gets, you just have to update the balls who need it instead of checking them all 30 times per second. If you have many balls this could save a lot of cpu load.
Another "easier" (and maybe "lighter") way could be to do something like:
tried assigning directly ball_list[i] = ball.new() and works just fine as well. No improvements saving memory though.
About the onEnterFrame(), in my setup the balls are moving constantly and checking for a collision with the edges of the screen... I don't understand the how to dispatch a personalized event on hit without prior checking for the hit.