本文整理汇总了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;
}
示例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);
}
}