cocos2d-iphoneccparticlesystem

CCParticleSystemQuad isRunning/particleCount behaviour


I have some questions regarding the isRunning and particleCount properties of CCParticleSystemQuad.

I'm currently managing reuse of particle systems, thus I need a boolean check for if the system is currently running.

The two properties that I thought of trying are the ones I have a problem with

My code snips

    // getParticleSystemForFile
    if( !psq.isRunning ) { // tried replacing this with psq.particleCount
        [psq resetSystem];
        return psq;
    }

and

    //
    CCParticleSystemQuad *effect = [[GameObjSingleton get] getParticleSystemForFile:@"healEffect.plist"];
    if ( effect.parent ) {
        [effect.parent removeChild:effect cleanup:NO];
    }

The current behaviour is something like this:

isRunning - always returning 1

particleCount - always returning 0

So when I use particleCount, no new effects are created. When I use isRunning, new particle systems are always created


Solution

  • You want to check the active property.

    isRunning is a property of CCNode which tells you whether the node is paused or not in the scene graph.