码迷,mamicode.com
首页 > 其他好文 > 详细

粒子系统

时间:2016-02-27 20:34:43      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:

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);

 

 

粒子系统

标签:

原文地址:http://www.cnblogs.com/Blogs-young-chan/p/5223491.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!