In my game, I am trying to suspend this function when a colission takes place. Could anyone please help me out?
– Variables
local currentScore= 0
local scoreTxt = display.newText( "Score: "…currentScore , 100, 200, native.systemFont, 16 )
scoreTxt:setFillColor( 1, 0, 0 )
– Listener for your timer, updates score variable and updates the text
local function scoreKeeper( event )
currentScore = currentScore + 1
scoreTxt.text = "Score: "…currentScore
end
timer.performWithDelay( 2000, scoreKeeper, -1 )