码迷,mamicode.com
首页 > 其他好文 > 详细

quick cocos fire

时间:2015-03-08 15:37:06      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:

    local canfire = "cooldown" --"canfire" "cooldown"
    local interval=0
    
    
    scheduler.scheduleUpdateGlobal(function()  
        print(canfire)
        print(interval)
        if canfire == "cooldown" then
            interval=interval+1
            if interval > 60*2 then
                canfire="canfire"
                interval=0
            end            
        end
        
    end)
    
    
    
    local layer = display.newLayer():addTo(self)
    layer:setTouchEnabled(true)
    layer:setTouchMode(cc.TOUCH_MODE_ONE_BY_ONE)
    layer:addNodeEventListener(cc.NODE_TOUCH_EVENT, function (event)
        local x, y, prevX, prevY = event.x, event.y, event.prevX, event.prevY

        if event.name == "began" then
            print("touch")
            if canfire == "canfire" then
                print("fire")
                canfire = "cooldown"
            end
        elseif event.name == "moved" then
        elseif event.name == "ended" then
        end
        
        
        return true
    end)

 

quick cocos fire

标签:

原文地址:http://www.cnblogs.com/yufenghou/p/4321682.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!