创建序列帧动画特效
来源:互联网 发布:迷你电饭煲品牌知乎 编辑:程序博客网 时间:2024/05/18 01:35
首先从官方网站或者其他地方下载TexturePackerGUI到电脑上,然后利用这个软件制作plist文件,将它保存到resource文件夹下,然后创建。
代码不难,理解起来也不难,基本上看一遍就知道它的用法。
代码如下:
<span style="font-size:14px;">void Plane2::boom(Sprite* i){SpriteFrameCache *frameCache = SpriteFrameCache::getInstance();frameCache->addSpriteFramesWithFile("boom.plist", "boom.png");if (boom==NULL){ //初始化为空,进入判断boom = Sprite::createWithSpriteFrameName("tx5_1.png"); //创建新特效boom->setPosition(Vec2(i->getPositionX(), i->getPositionY())); //获取对象,设置为特效坐标this->addChild(boom, 5, 1); Animation* animation = Animation::create();animation->setDelayPerUnit(0.01f); //0.01秒播放序列帧动画animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_1.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_2.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_3.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_4.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_5.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_6.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_7.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_8.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_9.png"));animation->addSpriteFrame(frameCache->getSpriteFrameByName("tx5_10.png"));Animate* animate = Animate::create(animation);boom->runAction(Sequence::create(animate,CallFunc::create(CC_CALLBACK_0(Plane2::remove,this)),nullptr)); }}</span>
代码不难,理解起来也不难,基本上看一遍就知道它的用法。
0 0
- 创建序列帧动画特效
- unity序列帧动画的粒子特效
- unity序列帧特效动态创建播放
- cocos2d-x 序列帧动画与场景特效笔记
- Unity3D:粒子特效(Particle System)播放序列帧动画
- Unity3D:粒子特效(Particle System)播放序列帧动画
- cocos2dx 用序列帧创建帧动画
- Unity_创建序列帧动画_073
- CSS3动画效果:如何创建带有反弹特效的动画?
- Cocos2d-x 2.1用png创建序列帧动画
- 使用 CocoStudio 创建 Cocos2d-x 序列帧和骨骼动画
- 使用 CocoStudio 创建 Cocos2d-x 序列帧和骨骼动画
- 使用 CocoStudio 创建 Cocos2d-x 序列帧和骨骼动画
- 使用CocoStudio创建Cocos2d-x序列帧和骨骼动画
- cocos2dx 3.13 用plist创建序列帧动画
- 关于cocos2d序列帧动画plist文件的创建
- AnimationDrawable 帧动画 爆炸特效
- iOS序列桢动画创建方式
- 1057. 数零壹(20)
- easyui 里 table 的 form提交后台获取的值全为null
- 电脑连接打印机
- maven jetty 多模块部署 配置
- Pro Git学习笔记(二)
- 创建序列帧动画特效
- 手把手教你完成端口之一(理论篇)
- 搜狗笔试题:输入任意个偶数,找任意两个偶数之间的素数的个数的总和
- enum_learn
- 快捷使用netsh导出、导入windows网络配置
- TCP/IP协议三次握手与四次握手流程解析
- 快速幂及矩阵应用(学习)
- 定时器
- hadoop2.5.2加节点