当前位置: 首页>>代码示例>>C++>>正文


C++ ParticleSystemQuad类代码示例

本文整理汇总了C++中ParticleSystemQuad的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSystemQuad类的具体用法?C++ ParticleSystemQuad怎么用?C++ ParticleSystemQuad使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ParticleSystemQuad类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: showStarAni

void PBase::showStarAni(WJSprite *starSprite)
{
    if (WJUtils::equals(starSprite->getUserString(), "get"))
    {
        starSprite->setVisible(true);
    }
    else
    {
        Common::sound.play("Common:star");

        // 添加星星出现的粒子效果
        ParticleSystemQuad *starParticle = ParticleSystemQuad::create("particles/star.plist");
        starParticle->setPosition(Vec2(starSprite->getContentSize().width / 2, starSprite->getContentSize().height / 2));
        starSprite->addChild(starParticle);
        starParticle->setAutoRemoveOnFinish(true);

        starSprite->setUserString("get");
        starSprite->runAction(
            Sequence::create(
                ScaleTo::create(0.0f, 0.0f, 0.0f),
                Show::create(),
                Spawn::create(
                    ScaleTo::create(0.3f, 1.0f, 1.0f),
                    RotateBy::create(0.3f, 360.0f, 360.0f),
                    NULL),
                NULL));
    }
}
开发者ID:dalechngame,项目名称:libiigame,代码行数:28,代码来源:PBase.cpp

示例2: isCollisionWithCoin

bool GameScene::isCollisionWithCoin() //和金币的碰撞检测
{
    bool  aFlag = false;
    
    for (int i=0; i<coinArray.size(); i++) {
        Rect box =  coinArray.at(i)->boundingBox();
        if (player->boundingBox().intersectsRect(box))
        {
            //当金币可见的时候才放粒子效果和音效
            if ( coinArray.at(i)->isVisible() == true) {
            coinArray.at(i)->setVisible(false);
            //粒子效果
            ParticleSystemQuad *paritcle = ParticleSystemQuad::create("physic-con.plist");
            paritcle->setPosition(coinArray.at(i)->getPosition());
            paritcle->setAutoRemoveOnFinish(true);
            this->addChild(paritcle,8);
             
            this->progressUpdate();//调用进度条事件
                
            player->addScore(1);//加分

            if (isPlaySound) {
                SimpleAudioEngine::getInstance()->playEffect("eatcoin.caf");
                }
            } 
        }
    }
    return aFlag;
}
开发者ID:2011conquer,项目名称:MikuRun2,代码行数:29,代码来源:GameScene.cpp

示例3: ShipAccelerate

//飞船加速效果
void SceneGame::ShipAccelerate(const Point& point)
{
	ParticleSystemQuad *emitter = ParticleSystemQuad::create("Image/Comet.plist");
	emitter->setPosition(point);
	emitter->setRotation(-45.0);
	this->addChild(emitter, 10);
}
开发者ID:ColourfulLife,项目名称:SpaceGame,代码行数:8,代码来源:SceneGame.cpp

示例4: UI_addParticle

void StarNode::UI_addParticle(){
    
    Point delta = _starRef->getStartPoint() - _starRef->getEndPoint();
    
    //出一个星星试试
    ParticleSystemQuad *particle = CCParticleSystemQuad::create("Shoot.plist");
    this->addChild( particle );
    particle->setDuration( _starRef->getDuration() ); //持续时间
    particle->setPosition( Point() );
    
    //上270下90左0右180
    float x = delta.x;
    float y = delta.y;
    
    float angle ;
    
    if ( ( delta.x > -0.01 || delta.x < 0.01 ) ) {
        angle = 270;
    }else{
        angle = fabs( atanf( delta.y/delta.x ) *180/3.1415 );
    }

    if ( x >= 0 && y > 0) {
        
    }else if ( x < 0 && y >= 0 ){
        angle += 90;
    }else if ( x < 0 && y <= 0 ){
        angle += 180;
    }else if ( x >= 0 && y < 0 ){
        angle += 270;
    }
    
    particle->setAngle( angle );
    particle->setAngleVar( 0 );
}
开发者ID:LysGit,项目名称:meteor,代码行数:35,代码来源:StarNode.cpp

示例5: emittParticles

void Blocks::emittParticles(cocos2d::Layer *layer, cocos2d::Point point)
{
	ParticleSystemQuad *emitter = ParticleSystemQuad::create("Json/XXX.plist");
	emitter->retain();
	emitter->setPosition(point);
	layer->addChild(emitter, PARTICLE_ZORDER);
}
开发者ID:4an70m,项目名称:FallingBlocks,代码行数:7,代码来源:Blocks.cpp

示例6: init

bool GameScene::init(){
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Point origin = Director::getInstance()->getVisibleOrigin();
    
    auto sprite = Sprite::create("bj2.jpg");
    sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
    this->addChild(sprite, -4);
    
    auto bg1 = Sprite::create("b2.png");
    bg1->setAnchorPoint(Point(0, 0));
    bg1->setPosition(Point(0, 10));
    this->addChild(bg1, -3);
    
    auto bg2 = Sprite::create("b2.png");
    bg2->setAnchorPoint(Point(0, 0));
    bg2->setPosition(Point(bg1->getContentSize().width, 10));
    this->addChild(bg2, -3);
    
    distanceBg.pushBack(bg1);
    distanceBg.pushBack(bg2);
    
    auto bg3 = Sprite::create("b1.png");
    bg3->setAnchorPoint(Point(0, 0));
    bg3->setPosition(Point(0, 0));
    this->addChild(bg3, -2);
    
    auto bg4 = Sprite::create("b1.png");
    bg4->setAnchorPoint(Point(0, 0));
    bg4->setPosition(bg3->getContentSize().width, 0);
    this->addChild(bg4, -2);
    
    nearbyBg.pushBack(bg3);
    nearbyBg.pushBack(bg4);
    
    ParticleSystemQuad *emiter = ParticleSystemQuad::create("dirt.plist");
    emiter->setPosition(visibleSize.width/2, visibleSize.height/2);
    this->addChild(emiter, -3);
    
    map = TMXTiledMap::create("map.tmx");
    map->setAnchorPoint(Point(0, 0));
    map->setPosition(Point(0, 0));
    this->addChild(map, -1);

    addPlayer(map);
    addHeart(map);
    
    playFlyToScene();
    
    Node *ground = Node::create();
    float width = map->getContentSize().width;
    float height = map->getContentSize().height * 3 / 16;

    auto bottomBody = PhysicsBody::createEdgeSegment(Point(0, height), Point(width, height));
    ground->setPhysicsBody(bottomBody);
    this->addChild(ground);
    
    return true;
}
开发者ID:LLSkittles,项目名称:el_demo,代码行数:59,代码来源:GameScene.cpp

示例7: onDialogShown

void ShowStar::onDialogShown(LBModalDialog *dialog)
{
	const Size &size = Director::getInstance()->getWinSize();
	ParticleSystemQuad *particle = ParticleSystemQuad::create("particles/opennning.plist");
	particle->setPosition(dialog->convertToNodeSpace(Vec2(size.width / 2, size.height / 2)));
	particle->setPositionType(ParticleSystem::PositionType::RELATIVE);
	dialog->addChild(particle, 50);
}
开发者ID:dalechngame,项目名称:mygame,代码行数:8,代码来源:ShowStar.cpp

示例8: playParticle

void Star::playParticle()
{
	const Size &size = this->getContentSize();
	ParticleSystemQuad *particle = ParticleSystemQuad::create("particles/heartui.plist");
	particle->setPosition(Vec2(size.width / 2, size.height / 2)+ Vec2(0, 0));
	particle->setPositionType(ParticleSystem::PositionType::RELATIVE);
	this->addChild(particle, 1000);
}
开发者ID:dalechngame,项目名称:mygame,代码行数:8,代码来源:Star.cpp

示例9: playStarParticle

void ShowStar::playStarParticle(WJSprite *sprite, const char * file)
{
	// 播放粒子效果
	ParticleSystemQuad *particle = ParticleSystemQuad::create(file);
	particle->setPosition(sprite->getPosition());
	particle->setPositionType(ParticleSystem::PositionType::RELATIVE);
	sprite->getParent()->addChild(particle, sprite->getLocalZOrder() + 10);
}
开发者ID:dalechngame,项目名称:mygame,代码行数:8,代码来源:ShowStar.cpp

示例10: if

bool Breakout::onConcactBegan(PhysicsContact& contact) {

	auto nodeA = contact.getShapeA()->getBody()->getNode();
	auto nodeB = contact.getShapeB()->getBody()->getNode();
	if (nodeA->getTag() == 1 || nodeB->getTag() == 1) {
		if(time > 0) dead();
	}
	else {
		//播放碰撞音效
		SimpleAudioEngine::getInstance()->playEffect("music/meet_stone.wav");

		//陨石爆炸并消失
		ParticleSystemQuad* fireWorks;
		if (nodeA->getTag() != 100) {
			nodeA->getPhysicsBody()->setName("isContact");
			if (nodeA->getTag() == 10) {
				blood -= 10;
				fireWorks = ParticleSystemQuad::create("fire1.plist");
			}
			else if (nodeA->getTag() / 10000 == 20) {
				blood -= 15;
				fireWorks = ParticleSystemQuad::create("fire2.plist");
			}
			else {
				blood -= 20;
				fireWorks = ParticleSystemQuad::create("fire3.plist");
			}
			fireWorks->setPosition(nodeA->getPosition());
			this->removeChild(nodeA);
		}
		else {
			nodeB->getPhysicsBody()->setName("isContact");
			if (nodeB->getTag() == 10) {
				blood -= 10;
				fireWorks = ParticleSystemQuad::create("fire1.plist");
			}
			else if (nodeB->getTag() == 20) {
				blood -= 15;
				fireWorks = ParticleSystemQuad::create("fire2.plist");
			}
			else {
				blood -= 20;
				fireWorks = ParticleSystemQuad::create("fire3.plist");
			}
			fireWorks->setPosition(nodeB->getPosition());
			this->removeChild(nodeB);
		}
		this->addChild(fireWorks, 1);
		for (int i = 0; i < enemys.size(); i++) {
			if (enemys.at(i)->getName() == "isContact") {
				enemys.erase(enemys.begin() + i);
			}
		}
		pT->setPercentage(blood);
		if (blood <= 0) dead();
	}
	return true;
}
开发者ID:CPYcpyCPY,项目名称:C-Cocos2d,代码行数:58,代码来源:BreakoutScene.cpp

示例11: addExplosion

void World::addExplosion(const Vec2 &position)
{
	std::string filename = "particle/explosion.plist";
	
	ParticleSystemQuad *emitter = ParticleSystemQuad::create(filename);
	emitter->setPosition(position);
	emitter->setScale(0.4);
	
	addChild(emitter);
}
开发者ID:mengtest,项目名称:ShooterCcx3,代码行数:10,代码来源:World.cpp

示例12: ParticleSystemQuad

ParticleSystemQuad * ParticleSystemQuad::create() {
    ParticleSystemQuad *pParticleSystemQuad = new ParticleSystemQuad();
    if (pParticleSystemQuad && pParticleSystemQuad->init())
    {
        pParticleSystemQuad->autorelease();
        return pParticleSystemQuad;
    }
    CC_SAFE_DELETE(pParticleSystemQuad);
    return NULL;
}
开发者ID:ADoby,项目名称:Project_Space_Pirate,代码行数:10,代码来源:CCParticleSystemQuad.cpp

示例13: new

ParticleSystemQuad * ParticleSystemQuad::create() {
    ParticleSystemQuad *particleSystemQuad = new (std::nothrow) ParticleSystemQuad();
    if (particleSystemQuad && particleSystemQuad->init())
    {
        particleSystemQuad->autorelease();
        return particleSystemQuad;
    }
    CC_SAFE_DELETE(particleSystemQuad);
    return nullptr;
}
开发者ID:253056965,项目名称:cocos2d-x-lite,代码行数:10,代码来源:CCParticleSystemQuad.cpp

示例14: run

void CreateRainEvent::run()
{
    this->setDone();
    
    Size size = Director::getInstance()->getVisibleSize();
    ParticleSystemQuad* rain = ParticleSystemQuad::create("img/rain.plist");
    rain->setPosition(Vec2(size.width/2,size.height));

    DungeonSceneManager::getInstance()->getScene()->addChild(rain);
}
开发者ID:TeamLS,项目名称:6chefs2,代码行数:10,代码来源:EffectEvent.cpp

示例15: addExplosionEffect

void BattleScene::addExplosionEffect(Vec2 point)
{
    std::string fileName="boxBreak.plist";
    ParticleSystemQuad *effect = ParticleSystemQuad::create(fileName);
    auto scene =Director::getInstance()->getRunningScene();
    if (scene) {
        scene->addChild(effect,1000);
    }
    effect->setAutoRemoveOnFinish(true);
    effect->setPosition(point);
}
开发者ID:xiatian0019,项目名称:Chump,代码行数:11,代码来源:BattleScene.cpp


注:本文中的ParticleSystemQuad类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。