Hi!
I am trying to use a Timer, which calls a function every second in lua.
How can I do that?
I am not able to use http://www.cocos2d-x.org/reference/native-cpp/V3.3rc0/d9/dfa/classcocos2d_1_1_timer_target_callback.html
Hi!
I am trying to use a Timer, which calls a function every second in lua.
How can I do that?
I am not able to use http://www.cocos2d-x.org/reference/native-cpp/V3.3rc0/d9/dfa/classcocos2d_1_1_timer_target_callback.html
I think you can use this api
cc.Director:getInstance():getScheduler():scheduleScriptFunc(function,interval,paused)
That works, Thanks. How can I unschedule the function?
You can do it as follows:
local schedulerEntry = cc.Director:getInstance():getScheduler:scheduleScriptFunc(function, interval, paused )
cc.Director:getInstance():getScheduler:unscheduleScriptEntry(schedulerID)