粒子系统

cocos2d-x提供的粒子系统有CCParticleSystem类实现,实现了对粒子的控制与调度,对粒子的操作包括以下:
产生粒子:也被称作粒子发射器emitter。
更新粒子状态:引擎会随着时间更新粒子位置、速度已经其他状态。
回收无效粒子:当粒子的生存周期结束后,就会被系统回收。
 
从plist文件中导出粒子效果
bool initWithFile(const char *plistFile);
static CCParticleSystem* create(const char *plistFile);

 

 
一个简单的粒子效果,在游戏场景中添加一个雪花效果,在GameScene::init方法中添加一下代码:
例如:
CCParticleSystem *particle = CCParticleSnow::node();
particle->setTexture(CCTextureCache::sharedTextureCache()->addImage("snow.png"));
this->addChild(particle);

 

 

posted @ 2016-02-27 20:22  ChenYao_Freedom  阅读(390)  评论(0编辑  收藏  举报