My question is for apps written in cocos2d v1.1.0-beta2b for ios:
What are the best practices for removing/releasing a CCParticleSystem?
One way I know of is using setAutoRemoveOnFinish:YES.
[emitter setAutoRemoveOnFinish:YES];
[emitter stopSystem];
Another way is removing the emitter manually using removeChild.
Are there any others? Which way is usually recommended?
As a side note, are there any known issues regarding CCParticleSystem removal/release under cocos2d v1.1.0-beta2b?
To remove a particle system, just remove it from its parent node. It's the best way.
If your particle system doesn't have a infinite duration, the best way is use setAutoRemoveOnFinish
. It will automatically remove the system from parent node when particle system ends.
If your particle system have a infinite duration, then use removeChild
with cleanUp:YES
(you dont need to set stopSystem before
). This way the system is removed forced.
Or you can use stopSystem
with setAutoRemoveOnFinish:YES
, and the system will be removed after the last particle ends. This way the system is removed smoothly.
Other tips:
CCParticleSystemQuad
instead of CCParticleSystem
.autorelease
constructor, like [CCParticleSystemQuad particleWithFile:]
or [CCParticleSystemQuad particleWithTotalParticles:]
. release
if you have a property retaining it.