Beispiel #1
0
//------------------------------------------------------------------
//
// StressTest2
//
//------------------------------------------------------------------
StressTest2::StressTest2()
{
	CCSize s = CCDirector::sharedDirector()->getWinSize();
	
	CCLayer* sublayer = CCLayer::node();
	
	CCSprite *sp1 = CCSprite::spriteWithFile(s_pPathSister1);
	sp1->setPosition( CCPointMake(80, s.height/2) );
	
	CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0));
	CCActionInterval* move_ease_inout3 = CCEaseInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 2.0f);
	CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
	CCFiniteTimeAction* seq3 = CCSequence::actions( move_ease_inout3, move_ease_inout_back3, NULL);
	sp1->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3) );
	sublayer->addChild(sp1, 1);

	CCParticleFire* fire = CCParticleFire::node();
	fire->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png"));
	fire->setPosition( CCPointMake(80, s.height/2-50) );
	
	CCActionInterval* copy_seq3 = (CCActionInterval*)(seq3->copy()->autorelease());
	
	fire->runAction( CCRepeatForever::actionWithAction(copy_seq3) );
	sublayer->addChild(fire, 2);
			
	schedule(schedule_selector(StressTest2::shouldNotLeak), 6.0f);
	
	addChild(sublayer, 0, kTagSprite1);
}
Beispiel #2
0
void GameEntityView::doLifedrain( ICastEntity* to )
{
	CCParticleFire* life = CCParticleFire::createWithTotalParticles(25);
	CCPoint point =  m_healthBar->boundingBox().origin;

	life->setStartColor( ccc4f(0,1.0f,0,1.0f) );
	life->setEndColor( ccc4f(0,1.0f,0,1.0f) );
	life->setPosition(ccp(0,0));

	//TODO: use physics interface to get position of 'to' entity and direct stream

	life->setGravity( CCPointMake( -30, 0 ) );
	life->setStartSize(25);
	life->setPosVar( CCPointMake( 10,10 ));

	m_healthBar->addChild(life);

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

	life->runAction(seq);
}
Beispiel #3
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);
}
Beispiel #4
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);
}
void ParticleTest::btnClick(CCObject* pSender, CCControlEvent event){
//    CCParticleBatchNode
//    CCParticleSystemQuad *particle = =CCParticleSystemQuad::create("");
    
    CCParticleFire *fire = CCParticleFire::create();
    fire->setPosition(ccp(320, 500));
    this->addChild(fire);
}