Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Reusing emitter in TNT Particle Engine — Gideros Forum

Reusing emitter in TNT Particle Engine

ar2rsawseenar2rsawseen Maintainer
edited January 2013 in General questions
Hello all (especially @GregBUG :) )

After @atilim awesome example
http://www.giderosmobile.com/forum/discussion/comment/17263#Comment_17263

I've tried to implement poll method for reusing the objects to improve performance in one of my projects.
And while it works awesome with Bitmap's etc, I'm was having problem implementing it in TNT Particle Engine.

So I wanted to share my solution for reusing it ;)

At first I thought I'd only need to reuse emitter, and could simply change it's parents, but then I noticed, that particles are added to parent only when you assign particles to emitter (because they are created beforehand, right the needed amount of them) and you can't re-assign particle to emitter twice (to re-add particles to new parent).

So the easy work around is to create a dummy parent sprite, which you assign to emitter as parent group and then all you have to do is to start/stop emitter and re-add the dummy parent to where you need it. That's way you can easy reuse same emitter in poll (without any modifications to the TNT Engine) ;)

Likes: GregBUG

+1 -1 (+1 / -0 )Share on Facebook

Comments

Sign In or Register to comment.