cocos2d-x笔记(十)Lua开发飞机大战-4-创建主角
来源:互联网 发布:淘宝电器小家电 编辑:程序博客网 时间:2024/06/05 02:03
飞机大战之所以叫飞机大战,肯定要飞机才行。这一篇我们就为游戏添加一架飞机——也就是我们的主角。
先创建一个图层(PlaneLayer)用来显示飞机,然后在create方法中初始化飞机
module("PlaneLayer",package.seeall) local plane = nilisAlive = truefunction create()local planeLayer = CCLayer:create()CCSpriteFrameCache:sharedSpriteFrameCache():addSpriteFramesWithFile("Images/shoot.plist")plane = CCSprite:createWithSpriteFrameName("hero1.png")plane:setPosition(ccp(visibleSize.width / 2,plane:getContentSize().height / 2))planeLayer:addChild(plane)isAlive = truereturn planeLayerend
主角这样登场显得有些草率和唐突,现在为主角的出场添加一点效果
local blink = CCBlink:create(1,3)local animation = CCAnimation:create()animation:setDelayPerUnit(0.1)animation:addSpriteFrame(CCSpriteFrameCache:sharedSpriteFrameCache():spriteFrameByName("hero1.png"))animation:addSpriteFrame(CCSpriteFrameCache:sharedSpriteFrameCache():spriteFrameByName("hero2.png"))local animate = CCAnimate:create(animation)plane:runAction(blink)plane:runAction(CCRepeatForever:create(animate))
0 0
- cocos2d-x笔记(十)Lua开发飞机大战-4-创建主角
- cocos2d-x笔记(十一)Lua开发飞机大战-5-让飞机动起来
- cocos2d-x笔记(七)Lua开发飞机大战-1-搭建开发环境
- cocos2d-x笔记(八)Lua开发飞机大战-2-游戏加载界面
- cocos2d-x笔记(九)Lua开发飞机大战-3-背景图的滚动
- quick-cocos2d-x 飞机大战(打飞机)小demo教程------主角飞机类
- [cocos2d-x][游戏开发]通过cocos2d-x实现简易飞机大战 04.游戏界面 主角飞机的添加
- [cocos2d-x][游戏开发]通过cocos2d-x实现简易飞机大战 05.游戏界面 主角飞机的移动
- [cocos2d-x][游戏开发]通过cocos2d-x实现简易飞机大战 06.游戏界面 主角飞机产生子弹
- cocos2d-x(十一)Lua开发飞机大战-6-添加子弹
- cocos2d-x(十二)Lua开发飞机大战-7-添加敌机
- Cocos2d-x3.X入门游戏实例(一) 经典飞机大战开发笔记
- Cocos2d-x飞机大战教程笔记
- [cocos2d-x][游戏开发]通过cocos2d-x实现简易飞机大战02 主界面创建
- Cocos2d-x 3.2 lua飞机大战开发实例(一)背景地图,飞机,子弹的封装,以及lua中定时器的使用
- Cocos2d-x 3.2 lua飞机大战开发实例(二)敌机类的封装,以及碰撞检测的实现
- 小小菜之Cocos2d-x游戏开发旅程——项目实例:飞机大战(4)
- 【cocos2d-x入门实战】微信飞机大战之四:主角的登场和帧动画
- Android DAO
- iOS7中UILabel根据内容自动调整高度
- 使用keychain保存用户名和密码等敏感信息 KeychainItemWrapper和SFHFKeychainUtils。
- Protocol Buffers 安装及问题解决的方法
- jsp标签
- cocos2d-x笔记(十)Lua开发飞机大战-4-创建主角
- Tomcat 登陆问题 创建用户名密码
- Java程序员的10道XML面试题
- poj3273 Monthly Expense
- 求数列的下一个排列
- 关于error LNK:2019错误的札记
- 在actionbar的PopupWindow
- 打造自己的字节序转换函数(16位、32位和64位)
- 酷派手机出货量创历史新高 单月超600万台