KDvoid Level1Scene::ExplosionAnimation ( CCPoint tPos,const KDchar* szImgName ) { CCParticleExplosion* pEmitter = new CCParticleExplosion ( ); pEmitter->setTexture(CCTextureCache::sharedTextureCache ( )->addImage ( szImgName ) ); pEmitter->initWithTotalParticles ( 10 ); pEmitter->setStartSize ( 20.0f ); pEmitter->setSpeed ( 50.0f ); pEmitter->setAnchorPoint ( ccp ( 0.5f,0.5f ) ); pEmitter->setPosition ( tPos ); pEmitter->setDuration ( 0.5f ); ccColor4F startColor = { 219.5f, 147.5f, 29.5f, 1.0f }; pEmitter->setStartColor ( startColor ); ccColor4F startColorVar = { 219.5f, 147.5f, 29.5f, 1.0f }; pEmitter->setStartColorVar ( startColorVar ); ccColor4F endColor = { 167.1f, 91.1f, 39.1f, 1.0f }; pEmitter->setEndColor ( endColor ); ccColor4F endColorVar = { 167.1f, 91.1f, 39.1f, 1.0f }; pEmitter->setEndColorVar ( endColorVar ); pEmitter->setAutoRemoveOnFinish ( KD_TRUE ); pEmitter->retain ( ); addChild ( pEmitter, 1 ); pEmitter->release ( ); }
CCParticleExplosion* CCParticleExplosion::createWithTotalParticles(unsigned int numberOfParticles) { CCParticleExplosion* pRet = new CCParticleExplosion(); if (pRet && pRet->initWithTotalParticles(numberOfParticles)) { pRet->autorelease(); } else { CC_SAFE_DELETE(pRet); } return pRet; }