Im trying to add more time to a timer when a score is reached but when the time is added it will only count down so far and not back to 0. What am I missing? Also how can I tell it to add more time ever time an addition score of 15 is reached? Here is what I have now…
[lua]local timeLimit = 20
timeLeft = display.newText(timeLimit, 160, 20, native.systemFontBold, 100)
timeLeft.x = display.contentCenterX
timeLeft.y = display.contentCenterY
timeLeft:setTextColor(0,0,0)
local function timerDown()
timeLimit = timeLimit-1
timeLeft.text = timeLimit
if(timeLimit==0)then
storyboard.gotoScene(“restart”)
end
end
timer.performWithDelay(1000,timerDown,timeLimit)
function shoot(event)
if event.phase == “began” then
bullsEye.x = math.random(0, display.contentWidth - 40)
bullsEye.y = math.random(0, display.contentHeight - 100)
score = score + 1
scoreText.text = score
if score == 15 then
timeLimit = timeLimit + 5
end
end
return true
end[/lua]