Friday, August 09, 2013

CCParticleSystem in Cocos2d-x with PList File

This code will run a plist particle system in Cocos2d-x

CCParticleSystem* emitter = CCParticleSystemQuad::create("blood.plist");
this->addChild( emitter, 5 );
emitter->setPosition( deadMonster->getSprite()->getPosition());
CCCallFunc* moveCallback = CCCallFunc::create(emitter, 
               callfunc_selector(CCParticleSystem::removeFromParent));
CCDelayTime* delayAction = CCDelayTime::create(0.3f);
emitter->runAction(CCSequence::create(delayAction, moveCallback, NULL));

No comments: