Example #1
0
void GameEntityView::doHeal()
{
	CCParticleFire* heal = CCParticleFire::createWithTotalParticles(25);
	CCPoint point = CCPointMake(  m_healthBar->getContentSize().width/2, 0 );

	heal->setStartColor( ccc4f(1,1,1,1.0f) );
	heal->setEndColor( ccc4f(1,1,1,1.0f) );

	heal->setSpeed(10);
	heal->setStartSize(15);
	CCPoint posVar = heal->getPosVar();
	posVar.y /= 2;
	heal->setPosVar( posVar );

	heal->setPosition( point );
	m_healthBar->addChild(heal);

	CCSequence* seq = CCSequence::create(
					CCDelayTime::create(0.5f),
					CCCallFunc::create(heal, callfunc_selector(CCParticleFire::stopSystem)),
					CCDelayTime::create(1.5f),
					CCRemoveSelf::create(true),
					NULL
				);

	heal->runAction(seq);
}
Example #2
0
void GameEntityView::doBurn()
{
	//CCLog("particle system burn");

	CCParticleFire* fire = CCParticleFire::createWithTotalParticles(150);
	CCPoint point = CCPointMake(  m_healthBar->getContentSize().width/2, 0 );

	//fire->stopSystem();
	fire->setSpeed(20);
	fire->setStartSize(25);
	CCPoint posVar = fire->getPosVar();
	posVar.y /= 2;
	fire->setPosVar( posVar );

	fire->setPosition( point );
	m_healthBar->addChild(fire);

	CCSequence* seq = CCSequence::create(
					CCDelayTime::create(0.5f),
					CCCallFunc::create(fire, callfunc_selector(CCParticleFire::stopSystem)),
					CCDelayTime::create(2.5f),
					CCRemoveSelf::create(true),
					NULL
				);

	fire->runAction(seq);
}