コード例 #1
0
//------------------------------------------------------------------
//
//Advance Particle Animation
//
//------------------------------------------------------------------
void ParticleAnimation::onEnter()
{
    ParticleDemo::onEnter();
    
    CCSprite *tSprite = CCSprite::spriteWithFile("Images/spritesheet1.png");
    m_emitter = CCParticleAniamtion::node();
    m_emitter->retain();
    m_background->addChild(m_emitter, 10);
    
    m_emitter->setLife(3.0f);
    m_emitter->setLifeVar(2.5f);
    
    // angle
	m_emitter->setAngle(90);
	m_emitter->setAngleVar(360);
    
    // speed of particles
	m_emitter->setSpeed(50);
	m_emitter->setSpeedVar(35);
    
    ((AdvanceParticleQuadSystem *)m_emitter)->setDisplayFrameForAnimation(tSprite->displayedFrame(), 32, 32, 10, false);
    
    m_emitter->setEmissionRate(10000);
    
    ((AdvanceParticleQuadSystem *)m_emitter)->setStartSize(32.0f);
    ((AdvanceParticleQuadSystem *)m_emitter)->setEndSize(32.0);
    setEmitterPosition();
}
コード例 #2
0
void CCAnimate::startWithTarget(CCNode *pTarget)
{
	CCActionInterval::startWithTarget(pTarget);
	CCSprite *pSprite = (CCSprite*)(pTarget);

	CC_SAFE_RELEASE(m_pOrigFrame);

	if (m_bRestoreOriginalFrame)
	{
		m_pOrigFrame = pSprite->displayedFrame();
		m_pOrigFrame->retain();
	}
}