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


C++ CCParticleSystemQuad::setAutoRemoveOnFinish方法代码示例

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


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

示例1: useFZPower

void ShowLayer::useFZPower(Vec2 pt)
{
	//点击粒子特效
	CCParticleSystemQuad *mParticle = CCParticleSystemQuad::create("showClick.plist");
	mParticle->setScale(0.5f);
	mParticle->setPosition(pt);

	//如果不设置,粒子播放后内存不释放
	mParticle->setAutoRemoveOnFinish(true);
	this->addChild(mParticle);

	Size visibleSize = Director::getInstance()->getVisibleSize();

	Vec2 pt2;
	pt2.x = (pt.x - visibleSize.width / 2) < 0 ? -5 : 5;
	pt2.y = (pt.y - visibleSize.height / 2) < 0 ? -5 : 5;

	auto action = MoveTo::create(0.2f, pt2);
	auto action2 = MoveTo::create(0.5f, Vec2(-pt2.x, -pt2.y));
	auto action3 = ScaleTo::create(0.2f, 1.1f);
	auto action4 = ScaleTo::create(0.5f, 1.0f);

	//屏幕震动特效
	this->m_Map->runAction(Sequence::create(Spawn::create(action, action3, NULL),
		Spawn::create(action2, action4, NULL), NULL));

	//使用人物技能
	m_PlayerManager->useFZ(pt, m_MonsterManager->getMonsterList(),
		m_BossManager->getboss(), m_FirePower);
}
开发者ID:zsn6493,项目名称:EATFUZI,代码行数:30,代码来源:ShowLayer.cpp

示例2: updateProjectiles

void GameScene::updateProjectiles(float dt)
{
	if (m_bullets->count() > 0)
	{
		CCObject* ob = NULL;
		CCARRAY_FOREACH(m_bullets, ob)
		{
			Projectile* proj = dynamic_cast<Projectile*>(ob);
			proj->update(dt);

			if (proj->getPositionX() < 0.f - proj->getContentSize().width || proj->getPositionX() > m_visibleSize.width + proj->getContentSize().width)
				m_removableBullets->addObject(proj);
			else if (checkCollisions(m_hero, proj) && proj->getType() == Projectile::Bullet)
			{
				m_removableBullets->addObject(proj);
				updateHealth(10); // dmg value here
			}
			else
			{
				for (uint i = 0; i < m_enemies->count(); ++i)
				{
					Enemy* en = dynamic_cast<Enemy*>(m_enemies->objectAtIndex(i));
					if (checkCollisions(en, proj) && proj->getType() == Projectile::Rocket)
					{
						m_removableBullets->addObject(proj);
						m_removables->addObject(m_enemies->objectAtIndex(i));
						
						CCParticleSystemQuad * smokeParticle = CCParticleSystemQuad::create("textures/smoke.plist"); 
						smokeParticle->setPosition(en->getPosition());
						this->addChild(smokeParticle);
						smokeParticle->setAutoRemoveOnFinish(true);
						
						CCParticleSystemQuad * dustParticle = CCParticleSystemQuad::create("textures/dusts.plist");
						dustParticle->setPosition(en->getPosition());
						this->addChild(dustParticle);
						dustParticle->setAutoRemoveOnFinish(true);
						CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("audio/rocketExplode.wav", false);
						CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("audio/enemyKill.wav", false);

						updateScore(); //score value here
					}
				}
			}
		}
开发者ID:S3lfik,项目名称:ccs2dx_smpl,代码行数:44,代码来源:GameScene.cpp

示例3: RunParticle

void MagicWitch::RunParticle() {
  CCParticleSystemQuad *particle = CCParticleSystemQuad::create(
      "witch0.plist");
  particle->setDuration(2.0f);
  particle->setPosition(ccp(
      particle->getPositionX() * SCALE_X,
      particle->getPositionY() * SCALE_Y));
  particle->setScale(BUTTON_SCALE);
  particle->setAutoRemoveOnFinish(true);
  my_layer_->getParent()->addChild(particle,
                                   gameconfig::WITCH_ANIM_NODE_ZORDER);
}
开发者ID:Tacus,项目名称:eigthtegame,代码行数:12,代码来源:magicwitch.cpp

示例4: tryLaunchParticle

bool RigidBlock::tryLaunchParticle(CCPoint emitPoint)
{

    CCParticleSystemQuad *particle = CCParticleSystemQuad::create("NewBlockParticle_1.plist");
    particle->setAnchorPoint(ccp(0.5f, 0.5));
    particle->setPosition(m_position);
    particle->setAutoRemoveOnFinish(true);
    
    
    this->addChild(particle);

    return true;
}
开发者ID:xdnm,项目名称:Jump,代码行数:13,代码来源:RigidBlock.cpp

示例5: playBurst

void Box::playBurst(CCNode* sender, void* data) {
    Tile2 *tile = static_cast<Tile2 *>(data);
    CCLOG("Scaling tile %d,%d with delay %f", tile->x, tile->y);
    CCFiniteTimeAction *action = CCSequence::create(
                                                    CCScaleTo::create(0.3f, 0.0f),
                                                    CCCallFuncN::create(this, callfuncN_selector(Box::removeSprite)),
                                                    NULL
                                                    );
    tile->sprite->runAction(action);


    // Add the balloon burst effect
    CCParticleSystemQuad *burst = CCParticleSystemQuad::create(burst_effect_filename.c_str());
    burst->setPosition(tile->pixPosition());
    burst->setAutoRemoveOnFinish(true);
    layer->addChild(burst);
    
}
开发者ID:nodegames,项目名称:matchblitz,代码行数:18,代码来源:Box.cpp

示例6: ccTouchBegan

bool BlackHoleEffectTest::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
	CCParticleSystemQuad* blackHoleParticle = CCParticleSystemQuad::create("blackHoleEffect.plist");
	blackHoleParticle->setPosition(touch->getLocation());
	blackHoleParticle->setAutoRemoveOnFinish(true);
	this->addChild(blackHoleParticle);

	BlackHoleEffect* bh = BlackHoleEffect::create();
	bh->setInHoleSelector(this, in_hole_selector(BlackHoleEffectTest::inHoleComplete));
	bh->setAttenuationSelector(this, attenuation_selector(BlackHoleEffectTest::attenuationComplete));
	bh->setOverSelector(this, over_selector(BlackHoleEffectTest::overComplete));
	bh->setUserObject(blackHoleParticle);
	bh->addSubstanceList(this->objList);
	bh->addHole(touch->getLocation().x, touch->getLocation().y);
	this->ary->addObject(bh);

	return true;
}
开发者ID:bontey,项目名称:geckosCocos2dxUtils,代码行数:18,代码来源:BlackHoleEffectTest.cpp

示例7: getParticle

CCParticleSystemQuad* ParticleManagerX::getParticle(const char *name)
{
  CCAssert(name && strlen(name) > 0, "!!! ParticleManager::getParticle(name) name is invalid");
  if (!name || strlen(name) <= 0) {
    return NULL;
  }
  CCParticleSystemQuad *particle = NULL;
  for(ParticleEmittersMap::iterator it = this->m_ParticleEmittersMap.begin(); it != this->m_ParticleEmittersMap.end(); it++) {
    ParticleEmitters *emitters = (ParticleEmitters*)(it->second);
    if (emitters && name) {
      particle = emitters->getParticle(name);
    }
    if (particle) {
      particle->setAutoRemoveOnFinish(true);
      break;
    }
  }
  return particle;
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:19,代码来源:particle_manager.cpp

示例8: Die

void Player::Die()
{
	// first reduce lives
	lives_ = (--lives_ < 0) ? 0 : lives_;

	// respawn only if there are lives remaining
	is_respawning_ = (lives_ > 0);

	// animate the death :(
	CCActionInterval* death = CCSpawn::createWithTwoActions(CCFadeOut::create(0.5f), CCScaleTo::create(0.5f, 1.5f));
	// call the appropriate callback based on lives remaining
	CCActionInstant* after_death = (lives_ <= 0) ? (CCCallFunc::create(this, callfunc_selector(Player::OnAllLivesFinished))) : (CCCallFunc::create(this, callfunc_selector(Player::Respawn)));
	runAction(CCSequence::createWithTwoActions(death, after_death));

	// play a particle...a sad one :(
	CCParticleSystemQuad* explosion = CCParticleSystemQuad::create("explosion.plist");
	explosion->setAutoRemoveOnFinish(true);
	explosion->setPosition(m_obPosition);
	game_world_->addChild(explosion);

	SOUND_ENGINE->playEffect("blast_player.wav");
}
开发者ID:karanseq,项目名称:SpaceCraze,代码行数:22,代码来源:Player.cpp

示例9: _initComponent

void LoginLayer::_initComponent() {
    CCSize size = CCDirector::sharedDirector()->getVisibleSize();
    
    /* 大游戏之名字 */
    CCSprite* nameOfGame = CCSprite::create("GAME_NAME.png");
    nameOfGame->setPosition(ccp(size.width / 2, size.height - 120));
    addChild(nameOfGame, 10);
    
    /* 可移动背景 */
    srand( (unsigned)time( NULL ) );
    int x = rand() % 2;
    int y = rand() % 1500;
    
    CCSprite* pLoginBg = CCSprite::create("bg_big.png");
    pLoginBg->setAnchorPoint(CCPointZero);
    pLoginBg->setPosition(ccp(-y/*(LOGIN_BG_WIDTH - size.width) / 2*/, 0));
    this->addChild(pLoginBg);
    if (x == 0) {
        CCActionInterval * move = CCMoveTo::create(LOGIN_BG_TIME, ccp(size.width - LOGIN_BG_WIDTH, 0));
        CCActionInterval * move1 = CCMoveTo::create(LOGIN_BG_TIME, ccp(0, 0));
        CCFiniteTimeAction * seq= CCSequence::create(move, move1, NULL);
        CCActionInterval * repeatForever =CCRepeatForever::create((CCActionInterval* )seq);
        pLoginBg->runAction(repeatForever);
    } else if (x == 1) {
        CCActionInterval * move = CCMoveTo::create(LOGIN_BG_TIME, ccp(0, 0));
        CCActionInterval * move1 = CCMoveTo::create(LOGIN_BG_TIME, ccp(size.width - LOGIN_BG_WIDTH, 0));
        CCFiniteTimeAction * seq= CCSequence::create(move, move1, NULL);
        CCActionInterval * repeatForever =CCRepeatForever::create((CCActionInterval* )seq);
        pLoginBg->runAction(repeatForever);
    }
    
    /* 效果火焰 */
    CCParticleSystemQuad* particle = CCParticleSystemQuad::create("dzt3.plist");
    particle->setAnchorPoint(CCPointZero);
    particle->setPosition(ccp(320, 0));
    particle->setScaleX(0.9);
    particle->setAutoRemoveOnFinish(true);
    
    addChild(particle, 11);
    
    /* 火星 */
    CCParticleSystemQuad* particlefire = CCParticleSystemQuad::create("firefly.plist");
    particlefire->setAnchorPoint(CCPointZero);
    particlefire->setPosition(ccp(0, 800));
    particlefire->setAutoRemoveOnFinish(true);
    addChild(particlefire, 11);
    
    /* 火星1 */
    CCParticleSystemQuad* particlefire1 = CCParticleSystemQuad::create("firefly2.plist");
    particlefire1->setAnchorPoint(CCPointZero);
    particlefire1->setPosition(ccp(0, 800));
    particlefire1->setAutoRemoveOnFinish(true);
    addChild(particlefire1, 11);
    
    /* 开始游戏按钮 */
    CCMenuItemImage *pLoginBtn = CCMenuItemImage::create( "pre.png",
                                                         "def.png",
                                                         this,
                                                         menu_selector(LoginLayer::gameInit));
    pLoginBtn->setAnchorPoint(ccp(0.5, 0));
    pLoginBtn->setPosition(ccp(size.width / 2, 70));
    CCMenu* pLoginMenu = CCMenu::create(pLoginBtn, NULL);
    pLoginMenu->setAnchorPoint(CCPointZero);
    pLoginMenu->setPosition(CCPointZero);
    this->addChild(pLoginMenu);
    CCSprite* startFont = CCSprite::create("start.png");
    startFont->setAnchorPoint(ccp(0.5, 0));
    startFont->setPosition(ccp(size.width / 2, 115));
    this->addChild(startFont);
    CCActionInterval * scale = CCScaleTo::create(1, 1.2);
    CCActionInterval * scale1 = CCScaleTo::create(1.5, 1);
    CCFiniteTimeAction * seq= CCSequence::create(scale,scale1,NULL);
    CCActionInterval * repeatForever =CCRepeatForever::create((CCActionInterval* )seq);
    startFont->runAction(repeatForever);
    
    /* 服务器列表滚动视图 */
    /*
     m_scrollView = CCScrollView::create(VIEW_SIZE);
     m_scrollView->setViewSize(VIEW_SIZE);
     m_scrollView->setContentSize(CCSizeMake(62*5, VIEW_SIZE.height));
     m_scrollView->setAnchorPoint(ccp(0, 0));
     m_scrollView->setPosition(SCROLLVIEW_OFFSETX, OFFSET_1136 + SCROLLVIEW_OFFSETY);
     m_scrollView->setDirection(kCCScrollViewDirectionHorizontal);
     m_scrollView->setBounceable(true);
     m_scrollView->setDelegate(this);
     this->addChild(m_scrollView);
     */
    
    for (int i = 0; i < 5; ++i) {
        CCMenuItemImage *pSvrBtn = CCMenuItemImage::create( "LG_nor.png",
                                                           "LG_nor.png",
                                                           this,
                                                           menu_selector(LoginLayer::option));
        pSvrBtn->setTag(SVRBG_NORMAL + i);
        pSvrBtn->setAnchorPoint(ccp(0, 0));
        pSvrBtn->setPosition(ccp(SCROLLVIEW_OFFSETX + 60 * i, m_pGameState->getBottomOffset() + SCROLLVIEW_OFFSETY));
        CCMenu* pMenu = CCMenu::create(pSvrBtn, NULL);
        pMenu->setAnchorPoint(ccp(0, 0));
        pMenu->setPosition(ccp(0, 0));
        this->addChild(pMenu);
//.........这里部分代码省略.........
开发者ID:qjsy,项目名称:QjGit,代码行数:101,代码来源:LoginLayer.cpp


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