粒子特效

来源:互联网 发布:cygwin linux 编辑:程序博客网 时间:2024/04/29 20:30


1、自定义粒子特效

使用ParticleDesigner工具生成plist动画文件,再使用下面代码即可实现。

ParticleSystemQuad * texiao = ParticleSystemQuad::create("texiao.plist");
texiao->setPosition(Point(0,0));
this->addChild(texiao);


2、自带粒子特效(举例11种)

  1. //爆炸效果  
  2.     CCParticleSystem* particleSystem = CCParticleExplosion::create();  
  3.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("stars.png"));  
  4.     addChild(particleSystem);  
  5.       
  6.     //火焰效果  
  7.     CCParticleSystem* particleSystem = CCParticleFire::create();  
  8.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  9.     addChild(particleSystem);  
  10.       
  11.     //花束效果  
  12.     CCParticleSystem* particleSystem = CCParticleFlower::create();  
  13.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  14.     addChild(particleSystem);  
  15.       
  16.     //烟花效果  
  17.     CCParticleSystem* particleSystem = CCParticleFireworks::create();  
  18.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  19.     addChild(particleSystem);  
  20.       
  21.     //星系效果  
  22.     CCParticleSystem* particleSystem = CCParticleGalaxy::create();  
  23.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  24.     addChild(particleSystem);  
  25.   
  26.     //流星效果  
  27.     CCParticleSystem* particleSystem = CCParticleMeteor::create();  
  28.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  29.     addChild(particleSystem);  
  30.       
  31.     //下雨效果  
  32.     CCParticleSystem* particleSystem = CCParticleRain::create();  
  33.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  34.     addChild(particleSystem);  
  35.       
  36.     //烟雾效果  
  37.     CCParticleSystem* particleSystem = CCParticleSmoke::create();  
  38.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  39.     addChild(particleSystem);  
  40.       
  41.     //下雪效果  
  42.     CCParticleSystem* particleSystem = CCParticleSnow::create();  
  43.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("snow.png"));  
  44.     addChild(particleSystem);  
  45.       
  46.     //漩涡效果  
  47.     CCParticleSystem* particleSystem = CCParticleSpiral::create();  
  48.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  49.     addChild(particleSystem);  
  50.       
  51.     //太阳效果  
  52.     CCParticleSystem* particleSystem = CCParticleSun::create();  
  53.     particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));  
  54.     addChild(particleSystem);  


0 0
原创粉丝点击