本文整理汇总了C++中CCParticleSystem::setAutoRemoveOnFinish方法的典型用法代码示例。如果您正苦于以下问题:C++ CCParticleSystem::setAutoRemoveOnFinish方法的具体用法?C++ CCParticleSystem::setAutoRemoveOnFinish怎么用?C++ CCParticleSystem::setAutoRemoveOnFinish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCParticleSystem
的用法示例。
在下文中一共展示了CCParticleSystem::setAutoRemoveOnFinish方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createParticleEffect
void HelloWorld::createParticleEffect(const char* filename, float x, float y, ccColor4F startColor, float duration, float endSize) {
CCParticleSystem* emitter = CCParticleSystemQuad::create(filename);
emitter->setPosition(x,y);
emitter->setStartColor(startColor);
emitter->setDuration(duration);
emitter->setEndSize(endSize);
emitter->setAutoRemoveOnFinish(true);
addChild(emitter, 10);
}
示例2: createExplodingRing
CCParticleSystem* ParticleLayer::createExplodingRing()
{
CCParticleSystem *emitter = new CCParticleSystemQuad();
emitter->initWithFile("Particles/ExplodingRing.plist");
emitter->setAutoRemoveOnFinish(true);
// emitter->setEndRadius(100.0f);
addChild(emitter, 10);
return emitter;
}
示例3: createExplosion
CCParticleSystem* ParticleLayer::createExplosion()
{
CCParticleSystem *emitter = CCParticleExplosion::create();
emitter->retain();
addChild(emitter, 10);
emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage("Particles/stars.png") );
emitter->setAutoRemoveOnFinish(true);
return emitter;
}
示例4: initExplosion
void TestParticle::initExplosion()
{
CCParticleSystem *emitter = CCParticleExplosion::create();
emitter->retain();
addChild(emitter, 10);
emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage("stars.png") );
emitter->setAutoRemoveOnFinish(true);
emitter->setPosition(ccp(400,50));
emitter->release();
}
示例5: createFireWorks
CCParticleSystem* ParticleLayer::createFireWorks()
{
CCParticleSystem *emitter = CCParticleFireworks::create();
emitter->retain();
emitter->setGravity(CCPointZero);
addChild(emitter, 10);
emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage("Particles/stars.png") );
emitter->setAutoRemoveOnFinish(true);
return emitter;
}
示例6: ccTouchesBegan
void HelloWorld::ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent)
{
CCNode* node = this->getChildByTag(TileMapNode);
//NSAssert([node isKindOfClass:[CCTMXTiledMap class]], @"not a CCTMXTiledMap");
CCTMXTiledMap* tileMap = (CCTMXTiledMap*)node;
// get the position in tile coordinates from the touch location
CCPoint touchLocation = this->locationFromTouch((cocos2d::CCTouch *)pTouches->anyObject());
CCPoint tilePos = this->tilePosFromLocation(touchLocation, tileMap);
//// move tilemap so that touched tiles is at center of screen
this->centerTileMapOnTileCoord(tilePos, tileMap);
// Check if the touch was on water (eg. tiles with isWater property drawn in GameEventLayer)
bool isTouchOnWater = false;
CCTMXLayer* eventLayer = tileMap->layerNamed("GameEventLayer");
int tileGID = eventLayer->tileGIDAt(tilePos);
//
if (tileGID != 0) {
CCDictionary* properties = tileMap->propertiesForGID(tileGID);
if (properties) {
//CCLOG(@"NSDictionary 'properties' contains:\n%@", properties);
const CCString * isWaterProperty = properties->valueForKey("isWater");
isTouchOnWater = isWaterProperty->boolValue();
}
}
// Check if the touch was within one of the rectangle objects
CCTMXObjectGroup* objectLayer = tileMap->objectGroupNamed("ObjectLayer");
//NSAssert([objectLayer isKindOfClass:[CCTMXObjectGroup class]],
// @"ObjectLayer not found or not a CCTMXObjectGroup");
bool isTouchInRectangle = false;
int numObjects = objectLayer->getObjects()->count();
for (int i = 0; i < numObjects; i++){
CCDictionary* properties = (CCDictionary*)objectLayer->getObjects()->objectAtIndex(i);
CCRect rect = this->getRectFromObjectProperties(properties, tileMap);
//
if (CCRect::CCRectContainsPoint(rect, touchLocation)) {
isTouchInRectangle = true;
break;
}
}
// decide what to do depending on where the touch was ...
if (isTouchOnWater) {
//[[SimpleAudioEngine sharedEngine] playEffect:@"alien-sfx.caf"];
CCLog("touchOnWater");
}
else if (isTouchInRectangle) {
CCLog("touchObject");
CCParticleSystem* system = CCParticleSystemQuad::particleWithFile("fx-explosion.plist");
system->setAutoRemoveOnFinish(true);
system->setPosition(touchLocation);
this->addChild(system, 1);
}
else {
#if 0
// get the winter layer and toggle its visibility
CCTMXLayer* winterLayer = tileMap->layerNamed("WinterLayer");
winterLayer->setVisible(!winterLayer->isVisible());
// other options you might be interested in are:
// remove the touched tile
winterLayer->removeTileAt(tilePos);
// add a specific tile
tileGID = winterLayer->tileGIDAt(CCPointMake(0, 19));
winterLayer->setTileGID(tileGID, tilePos);
#endif
}
}