摘要:
1.在removeLeftCardBg函数中移除addLeftCard函数所创建的对象self.left_CardSprite,应该写成上方代码形式,类似于c++中的析构,需要一层一层去删除; 2.如果写成 if self.left_CardSprite ~= nil then self.left_ 阅读全文
摘要:
local function onTouchBegan(touch, event) local point = touch:getLocation() --获取touch位置, 基于openGL坐标 local point = touch:getPreviousLocation() --获取前一次touch位置 基于openGL坐标 lo... 阅读全文
摘要:
lua中for循环的理解 for i=1, 10 do i = i+3 cclog("i %d",i) end 输出:4,5,6,7,8,9,10,11,12,13 相当于整体进行+3操作,代码中的1and10实际是指定了循环次数 改为: i = 1 repeat i = i+2 cclog("i 阅读全文