Hi people
I want top stop a stopwatch in a race game when the car pass the finish line
here the the stopwatch code:
[lua]
local timerCount = display.newText( “00:00:0”, 0, 0, native.systemFont, 38 )
timerCount.x = W / 2; timerCount.y = (H / 4) - 60
timerCount:setTextColor( 255, 255, 255 )
local function startTimer(e)
–startButtonText:removeSelf()
–startButtonText = nil
function timerCount:timer( event )
local count = event.count
tenthSeconds = math.floor(count % 10)
seconds = math.floor(count / 10 ); seconds = math.floor(seconds % 60)
minutes = math.floor(count / 600); minutes = math.floor(minutes % 60)
timeFormat = string.format("%02d:%02d:%01d", minutes, seconds, tenthSeconds)
self.text = timeFormat
if count >= 6000 then
timer.cancel( event.source ) – Cancel timer after 10 mins
end
end
timer.performWithDelay( 100, timerCount, 6000 ) – Call timerCount function every 1/10th second for 10 minutes
end
startTimer() [/lua]
i created this function to stop the finish line:
local function stopTimer(e)
–CODE
end
linhaChegada:addEventListener(“collision”, stopTimer)
but i dont know wich comand i use to stop counting the stop watch
Can someone help me? [import]uid: 154714 topic_id: 35918 reply_id: 335918[/import]