Problem With Countdown Timer

Hi

I am using the “Stopwatch Timing Class” made by Kyle Coburn ( http://developer.coronalabs.com/code/stopwatch-timing-class )  to help me up with the countDown timer and its really great. However, when the CountDown time becomes 0, it doesn’t stop the game play.

Here’s the CountDown code :

[lua]---------TIMER---------

local stopwatch = require “stopwatch”

local timerText = display.newEmbossedText("", 0, 0, “Therapy”, 30)
timerText.x = 280
timerText.y = 30
local countDown = stopwatch.new(5)

local function onFrame(event)

timerText:setText(countDown:toRemainingString())
end

Runtime:addEventListener(“enterFrame”, onFrame)

--------------------------[/lua]

Here’s the GameOver function code :

[lua]local function GameOver()
iceMaker:StopIce()

gameOverText = display.newText(hudGroup, “Game Over”, 0, 0, “Therapy”, 40)

gameOverText:setReferencePoint(display.CenterReferencePoint)
gameOverText.x = screenHW 
gameOverText.y = screenHH
gameOverText:addEventListener(“touch”, RestartHandler)

end[/lua]

Thanks

I would suggest posting a comment on that page in the Community Code or contact the author.  I’m not familiar with this library.

But if you can determine how much time is left, you could use an “if” statement in the onFrame function to call your gameover function when the time hits 0.

I would suggest posting a comment on that page in the Community Code or contact the author.  I’m not familiar with this library.

But if you can determine how much time is left, you could use an “if” statement in the onFrame function to call your gameover function when the time hits 0.