【问题标题】:Changing parameters on timers whilst game running在游戏运行时更改计时器的参数
【发布时间】:2013-01-21 13:35:28
【问题描述】:

当我的应用程序已经启动时,如何更改计时器的参数?

这是我的功能

increase = function()  
    frequency = frequency - 100
end

然后我得到一个按钮,应该增加计时器的频率

object:addEventListener("tap", 增加)

计时器:

频率 = 1000
superTimer = timer.performWithDelay(频率, spawnCircle, -1)

谢谢!乔金

【问题讨论】:

    标签: timer coronasdk


    【解决方案1】:
    local freq = 1000;
    
    
     function increase()  
        freq = freq - 100
        print(freq)
     end
    
    
    object:addEventListener("tap", increase)
    
    
    function myTimer()
         superTimer = timer.performWithDelay(freq,function () spawnCircle();myTimer() end, 1)
    end
    myTimer()
    

    这会奏效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-26
      • 2017-04-18
      • 2018-08-04
      • 2017-07-10
      • 2019-09-22
      相关资源
      最近更新 更多