I have spent too many days trying to figure out the root of the issue, so I appreciate any and all help.
Below is a snippet of my code. What I am doing is creating a timer that performs myFunc three times and updates count_down_text.text. I run this code when I am resuming my game from pause to show the user how much time they have before the game begins. For some reason, sometimes when I resume the game from this code, all the timers in my game temporarily stop working for about two seconds. I know that my scene:resumeGame () function works because everything works perfect when I don’t have the countdown text. Is there something that I am doing incorrectly? Thanks for your help.
[lua]
local count_down_text = display.newText(“3”, screenW*0.5, screenH*0.5, “Bubble Club”, 100)
local count = 3
local timer_handle
local function myFunc ()
count = count - 1
count_down_text.text = count
if(count == 0) then
count_down_text:removeSelf()
count_down_text = nil
timer.cancel(timer_handle)
scene:resumeGame()
end
end
timer_handle = timer.performWithDelay(1000, myFunc, 3)[/lua]