quick cocos schedule

local scheduler = require(cc.PACKAGE_NAME .. ".scheduler")

local MainScene = class("MainScene", function()
    return display.newScene("MainScene")
end)


function MainScene:ctor()
    scheduler.scheduleGlobal(function()  
        self:foo() --每秒调用的方法  
    end , 1)  -- 1 为时间
end

function MainScene:foo( dt )
    print("foo")
end

return MainScene
原文地址:https://www.cnblogs.com/yufenghou/p/4309985.html