cocos2d是一个基于MIT协议的开源框架,用于构建游戏、应用程序和其他图形界面交互应用。作为一个交互应用,自然存在特效的实现,下面是小编整理的关于cocos2d 粒子特效教程讲解,希望对你们有帮助!
cocos2d 粒子特效流程
粒子特效实质是很多的精灵,通过粒子系统赋给每个精灵初始属性,然后由发射器发射出来,并在粒子发射的过程中不断的刷新,更新他的属性,让粒子按照设定的方式变换。当粒子寿命到期后,粒子消亡,回到带发射状态,等待初始化发射。如下图所示:
cocos2d 粒子特效展示
//爆炸效果
CCParticleSystem* particleSystem = CCParticleExplosion::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("stars.png"));
addChild(particleSystem);
//火焰效果
CCParticleSystem* particleSystem = CCParticleFire::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
//花束效果
CCParticleSystem* particleSystem = CCParticleFlower::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
//烟花效果
CCParticleSystem* particleSystem = CCParticleFireworks::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
//星系效果
CCParticleSystem* particleSystem = CCParticleGalaxy::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
//流星效果
CCParticleSystem* particleSystem = CCParticleMeteor::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
//下雨效果
CCParticleSystem* particleSystem = CCParticleRain::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
//烟雾效果
CCParticleSystem* particleSystem = CCParticleSmoke::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
//下雪效果
CCParticleSystem* particleSystem = CCParticleSnow::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("snow.png"));
addChild(particleSystem);
//漩涡效果
CCParticleSystem* particleSystem = CCParticleSpiral::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
//太阳效果
CCParticleSystem* particleSystem = CCParticleSun::create();
particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png"));
addChild(particleSystem);
看了小编整理的关于cocos2d 粒子特效教程讲解,是不是觉得很有用呢?喜欢的话,赶快分享哦!
,Cocos2d教程,Cocos2d技巧