Ubuntu Cocos2dx 学习笔记——纹理动画
2014-04-14 19:17
405 查看
转载请标明出处:http://blog.csdn.net/tim_shadow/article/details/23698909
安装方式:
3.关键代码
1.图片资源
2.图片处理工具
Linux下面没有强大的PhotoShop ,但是 GIMP 也可以顺利完成基本的图片处理;安装方式:
sudo apt-get install gimpGIMP 的使用方式,自行摸索,这里不做说明
3.关键代码
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); //载入纹理 CCTexture2D* texture = CCTextureCache::sharedTextureCache()->addImage( "bird_fly.png"); //设定小鸟纹理的宽度和高度 float height = texture->getContentSize().height / 3; float width = texture->getContentSize().width; CCAnimation* animation = CCAnimation::create(); //设置间隔时间 animation->setDelayPerUnit(0.15f); //添加精灵帧 for (int i = 0; i < 3; i++) { animation->addSpriteFrameWithTexture(texture // x0,y0 , width, height CCRectMake(0, height*i, width, height)); } CCAnimate* animate = CCAnimate::create(animation); CCSprite*fish = CCSprite::create(); fish->setPosition(ccp(visibleSize.width/2,visibleSize.height/2)); fish->runAction(CCRepeatForever::create(animate)); addChild(fish);
相关文章推荐
- Ubuntu Cocos2dx 学习笔记——自定义动画
- Ubuntu Cocos2dx 学习笔记——Cocos2dx设计模式
- Cocos2dx学习笔记10:cocos2dx序列帧动画(1)
- Ubuntu Cocos2dx 学习笔记——使用Git管理本地代码
- Cocos2d-X 学习笔记 13 cocos2dx骨骼动画
- cocos2dx 3.3 + lua 学习笔记(04)--- 动作回调、函数回调、骨骼动画回调
- Unity Shader 学习笔记(18)纹理动画、顶点动画、广告牌技术
- cocos2dx学习笔记之帧动画详解
- Ubuntu Cocos2dx 学习笔记0331——创建项目
- UnityShader入门精要学习笔记(十六):纹理动画
- Ubuntu Cocos2dx 学习笔记——错误总结
- android动画学习笔记
- redis学习笔记(10)---ubuntu下redis的安装
- cocos2dx学习笔记:配置环境
- Cocos2dx 学习笔记整理----场景切换
- 前端学习笔记--jQuery--基础知识--动画篇
- Unity3D之Mecanim动画系统学习笔记(五):Animator Controller
- 学习笔记--Ubuntu优化相关内容
- Unity3D之Mecanim动画系统学习笔记(五):Animator Controller
- Ubuntu 学习笔记