在游戏运行时更改计时器上的参数

时间:2013-01-21 13:35:29

标签: timer corona

如何在我的应用程序启动后更改计时器上的参数?

这是我的功能

increase = function()  
    frequency = frequency - 100
end

然后我得到了一个按钮,可以增加定时器的频率

  

object:addEventListener(" tap",increase)

计时器:

  

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

谢谢!乔金姆

1 个答案:

答案 0 :(得分: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()

这将有效。