Hello,
I have started working on a new project with Corona SDK and I have come into a problem that a Google search can’t seem to resolve.
Anyway what I needed to do is change the delay of a timer whilst the game is running. Seeing that I am a newbie I have tried the most logical solution that comes to my mind.
[lua]
timerDelay = 1000;
local function myFunction()
print(“Hello!”)
end
myTimer = timer.performWithDelay( timerDelay, myFunction, 0)
[/lua]
And by changing the ‘timerDelay’ variable it would change the delay on the timer. But it does not.
My second attempt was this:
[lua]
testVariable = 10;
local function myFunction()
print(“Hello!”)
end
myTimer = timer.performWithDelay( 1000, myFunction, 0)
if( testVariable == 10 ) then
myTimer.delay = 500
print(“Goodbye!”)
end
[/lua]
And using the .delay doesn’t work (at least for me anyway).
Is there a way to accomplish this short of cancelling the timer and starting a new timer with a new delay?
Thanks for any help.
Jamie
[import]uid: 170292 topic_id: 36364 reply_id: 336364[/import]