Re: Few questions
Here one way to do a timer :
t = 0 -- timer t
startTimer = 0 -- timer off by default
timerInterval = 3*60 -- timer interval : here 3 seconds
timerLoop = 0 -- if you want the timer to loop, set timerLoop = 1
function onSceneUpdate()
if isKeyPressed("X") then
startTimer = 1
end
-- timer
if startTimer == 1 then
if t == timerInterval then
print("time up !")
t = 0
if timerLoop == 0 then
startTimer = 0
end
end
end
-- increment t
if startTimer == 1 then
t = t+1
end
end