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


C++ ParticleSystemQuad::addChild方法代码示例

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


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

示例1: onCollision

COLL_RET Bullet::onCollision(cocos2d::Node *other)
{
	const int otherTag = other->getTag();
	if (otherTag == COLL_TILE_GRASS
		|| otherTag == COLL_TILE_WATER
		|| otherTag == COLL_REBIRTH
		|| otherTag == COLL_AWARDS)
		return RETAIN;
	if (COLL_EDGE_BOTTOM == otherTag
		||COLL_EDGE_LEFT == otherTag
		||COLL_EDGE_RIGHT == otherTag
		||COLL_EDGE_TOP == otherTag)
	{
		return DESTROY;
	}
	
	if (COLL_BULLET == _tag || COLL_BULLET_IRON == _tag)
	{
		
		if (otherTag != COLL_FELLOWS &&otherTag != COLL_BULLET &&otherTag != COLL_BULLET_IRON)
		{
			ParticleSystemQuad * particle = ParticleSystemQuad::create("bullet_exp.plist");
			Sprite *tmpSprite = Sprite::createWithSpriteFrameName("bullet_exp.png");
			tmpSprite->setVisible(false);
			particle->setTextureWithRect(tmpSprite->getTexture(), tmpSprite->getTextureRect());
			particle->addChild(tmpSprite);
			particle->setScale(0.05f);
			particle->setPosition(this->getPosition());
			this->getParent()->addChild(particle, 2);
			particle->setAutoRemoveOnFinish(true);
			return DESTROY;
		}
	}
	else if (COLL_BULLET_ENEMIES == _tag)
	{   
		if (otherTag != COLL_ENEMIES && otherTag != COLL_BULLET_ENEMIES)
		{
			
			ParticleSystemQuad * particle = ParticleSystemQuad::create("bullet_exp.plist");
			Sprite *tmpSprite = Sprite::createWithSpriteFrameName("bullet_exp.png");
			tmpSprite->setVisible(false);
			particle->setTextureWithRect(tmpSprite->getTexture(), tmpSprite->getTextureRect());
			particle->addChild(tmpSprite);
			particle->setScale(0.05f);
			particle->setPosition(getPosition());
			this->getParent()->addChild(particle, 2);
			particle->setAutoRemoveOnFinish(true);
			return DESTROY;
		}
	}	
	return RETAIN;
}
开发者ID:yw920,项目名称:tank,代码行数:52,代码来源:Bullet.cpp

示例2: fire

void TankStateBullet::fire()
{
	int starNum = _tankSprite->getBulletAwardNum();
	if (_tankSprite->CanFire() && _tankSprite->getBulletNum() < 2){
		CCLOG("TankNode sprite fire");
		if (starNum >= 2)
		{
			CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(FileUtils::getInstance()->fullPathForFilename("audio/btndir.wav").c_str());
			_tankSprite->setBulletSpeed(_bulletSpeedBackup * 2.0f);
			if (3 == starNum)
			{
				_tankSprite->setBulletTag(NodeWithCollision::COLL_BULLET_IRON);
			}
		}
		else{
			CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(FileUtils::getInstance()->fullPathForFilename("audio/bullet.wav").c_str());
		}
		
		Bullet *norBullet = Bullet::create(MAPDATA->getCollDetector(), _tank);
		_tankSprite->getParent()->addChild(norBullet, -1);
		ParticleSystemQuad * particle = ParticleSystemQuad::create("bullet_smoke.plist");
		Sprite *tmpSprite = Sprite::createWithSpriteFrameName("bullet_smoke.png");
		tmpSprite->setVisible(false);
		particle->setTextureWithRect(tmpSprite->getTexture(), tmpSprite->getTextureRect());
		particle->addChild(tmpSprite);
		particle->setScale(0.2f);
		particle->setPosition(norBullet->getPosition());
		_tank->getParent()->addChild(particle, 2);
		particle->setAutoRemoveOnFinish(true);
		_tankSprite->insertBullet(norBullet);
	}
}
开发者ID:yw920,项目名称:tank,代码行数:32,代码来源:TankState.cpp


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