Esempio n. 1
0
ParticleExplosion* ParticleExplosion::createWithTotalParticles(unsigned int numberOfParticles)
{
    ParticleExplosion* pRet = new ParticleExplosion();
    if (pRet && pRet->initWithTotalParticles(numberOfParticles))
    {
        pRet->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pRet);
    }
    return pRet;
}
ParticleExplosion* ParticleExplosion::createWithTotalParticles(int numberOfParticles)
{
    ParticleExplosion* ret = new (std::nothrow) ParticleExplosion();
    if (ret && ret->initWithTotalParticles(numberOfParticles))
    {
        ret->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(ret);
    }
    return ret;
}
Esempio n. 3
0
ParticleExplosion* ParticleExplosion::create()
{
    ParticleExplosion* pRet = new ParticleExplosion();
    if (pRet && pRet->init())
    {
        pRet->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(pRet);
    }
    return pRet;
}
ParticleExplosion* ParticleExplosion::create()
{
    ParticleExplosion* ret = new (std::nothrow) ParticleExplosion();
    if (ret && ret->init())
    {
        ret->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(ret);
    }
    return ret;
}
//
// ParticleExplosion
//
ParticleExplosion* ParticleExplosion::createFireWorksRing()
{
    ParticleExplosion* ret = new ParticleExplosion();
    if (ret && ret->initWithTotalParticles(200))
    {
        ret->autorelease();
    }
    else
    {
        CC_SAFE_DELETE(ret);
    }
    return ret;
}
void WelcomeScene::particleEffect(Point pos)
{

	ParticleExplosion* effect = ParticleExplosion::create();
	effect->setTexture(Director::getInstance()->getTextureCache()->addImage("victoryMenu.png"));
	effect->setTotalParticles(10);

	//让其为图片本身的颜色
	effect->setStartColor(Color4F(255, 255, 255, 255));
	effect->setEndColor(Color4F(255, 255, 255, 0));

	effect->setStartSize(50.0f);

	effect->setLife(2.6f);
	effect->setSpeed(200);
	effect->setSpeedVar(10);
	effect->setPosition(pos);
	start->addChild(effect, 15);
}
Esempio n. 7
0
void Target::collisionOccoured(int type)
{
    if(type == AppUtils::CollisionType::CT_BALL_TARGET)
    {
        ParticleExplosion* explosion = ParticleExplosion::create();
        explosion->setTexture( Director::getInstance()->getTextureCache()->addImage("stars.png"));
        explosion->setAutoRemoveOnFinish(true);
        explosion->setPosition(m_position);
        explosion->setTotalParticles(500);
        explosion->setLife(1.5);
        explosion->setSpeed(500);
        this->addChild(explosion, 10);
    }
}
Esempio n. 8
0
void showStarParticleEffect(int color,Point position,Node* node){
	CCLOG("Particle Particle Particle");
	ParticleExplosion* effect = ParticleExplosion::create();
	effect->setTexture(Director::getInstance()->getTextureCache()->addImage("star.png"));
	effect->setTotalParticles(300);
	effect->setStartColor(getColor4F(color));
	effect->setStartColorVar(Color4F(0,0,0,1));
	effect->setEndColor(getColor4F(color));
	effect->setEndColorVar(Color4F(0,0,0,1));
	effect->setStartSize(25.0f);	// 初始化粒子元素的尺寸
	effect->setGravity(Point(0,-400));
	effect->setDuration(0.2f);
	effect->setLife(2.0f);
	effect->setSpeed(300.0f);
	effect->setSpeedVar(10);
	effect->setPosition(position);
	node->addChild(effect);
}