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


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

本文整理汇总了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);
}
开发者ID:pratiksapra,项目名称:SpaceGameTutorial,代码行数:9,代码来源:HelloWorldScene.cpp

示例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;
}
开发者ID:guinao,项目名称:CallofDefense,代码行数:11,代码来源:ParticleLayer.cpp

示例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;
}
开发者ID:guinao,项目名称:CallofDefense,代码行数:12,代码来源:ParticleLayer.cpp

示例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();
}
开发者ID:jinjianxin,项目名称:cocos2d-x,代码行数:13,代码来源:TestParticle.cpp

示例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;
}
开发者ID:guinao,项目名称:CallofDefense,代码行数:13,代码来源:ParticleLayer.cpp

示例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

	}
}
开发者ID:bboy0623,项目名称:testcocos2d,代码行数:74,代码来源:HelloWorldScene.cpp


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