I have my game set it when the time = 0 or the user has died to cancel the timer and move to the restart scene but I get an error with my timer.cancel. Anyone have any idea what I’m doing wrong?
[lua]local timeLimit = 20
local count = 0
local function timerDown()
timeLimit = timeLimit-1
timeLeft.text = timeLimit
if(timeLimit==0)then
timer.cancel(timerDown)
storyboard.gotoScene(“restart”)
storyboard.purgeScene(“game”)
end
end
timer.performWithDelay(1000,timerDown,-1)
function endGame(event)
if event.phase == “began” then
timer.cancel(timerDown)
storyboard.gotoScene(“restart”)
storyboard.purgeScene(“game”)
end
return true
end[/lua]