cocos-lua-spriteex
来源:互联网 发布:3dsmax2014软件许可证 编辑:程序博客网 时间:2024/05/01 18:46
local Sprite = cc.Sprite
function Sprite:playAnimationOnce(animation, args)
local actions = {}
local showDelay = args.showDelay or 0
if showDelay then
self:setVisible(false)
actions[#actions + 1] = cc.DelayTime:create(showDelay)
actions[#actions + 1] = cc.Show:create()
end
local delay = args.delay or 0
if delay > 0 then
actions[#actions + 1] = cc.DelayTime:create(delay)
end
actions[#actions + 1] = cc.Animate:create(animation)
if args.removeSelf then
actions[#actions + 1] = cc.RemoveSelf:create()
end
if args.onComplete then
actions[#actions + 1] = cc.CallFunc:create(args.onComplete)
end
local action
if #actions > 1 then
action = cc.Sequence:create(actions)
else
action = actions[1]
end
self:runAction(action)
return action
end
function Sprite:playAnimationForever(animation)
local animate = cc.Animate:create(animation)
local action = cc.RepeatForever:create(animate)
self:runAction(action)
return action
end
-- 开启/关闭外围包装盒,单个
function Sprite:setRectEnabled(args)
self.rect_list = self.rect_list or {}
if args then
local draw_node = cc.DrawNode:create()
dump(self:getSize())
local x, y = self:getPos()
local w, h = self:getSize().width, self:getSize().height
draw_node:drawRect(cc.p(x,y),cc.p(x + w , h + y),cc.c4b(100,255,0,100))
self.rect_list[#self.rect_list + 1] = draw_node
print("#self.rect_list",#self.rect_list)
draw_node:setName('rect'..#self.rect_list)
self:addme(draw_node,9999,#self.rect_list + 1000)
return self
end
if next(self.rect_list) == nil then return end
for i = #self.rect_list , 0 , -1 do
ChestError(self.rect_list[i]) -- 检查空指针
self:delObjByName(self.rect_list[i]:getName())
end
return self
end
0 0
- cocos-lua-spriteex
- cocos lua scheduler
- cocos lua学习笔记
- cocos-lua Test详解
- cocos-lua-Nodex
- cocos-,lua- tolua.cast
- cocos-lua-通知节点
- cocos-lua问题记录
- cocos-lua 表
- lua cocos class方法
- cocos-Lua 中的getPosition()
- cocos-Lua table积累
- cocos-Lua中的EditBox
- sublime + cocos lua
- cocos 寻路, lua
- cocos 寻路 lua实现
- cocos创建lua工程
- cocos lua 问题总结
- 剑指offer题解 数组中只出现一次的数字
- Java学习笔记(1)Introduction to Computers, Programs, and Java
- windows编程之进程枚举的三种方式
- Linux awk命令
- cocos-lua-Nodex
- cocos-lua-spriteex
- 【leetcode】113Path Sum II(DFS输出路径)
- HDU Divided Land(Java大数,二进制大数最大公约数)
- Android:如何把一个应用添加到Settings列表中...
- 用正则表达式提取单个页面文件里Email地址的简单实现
- <Android 基础(六)> ActionBar
- java实现gif动画效果(java显示动态图片)
- Java学习笔记(2)the Additional Part
- jvm调优