Does anyone know how to make a simple timer that shows up on the screen? This is a noobie question but I’m just getting into programming.
function setup()
time = 0
end
function draw()
time = time + 1 -- If you change this to subtracting, then it will count down by one
text(time, WIDTH/2, HEIGHT/2)
end
tween.delay() works well.
function setup()
counter = 1
timer(1,function() counter = counter+1 end)
end
function draw()
background(0, 0, 0, 255)
text("Count is: "..counter,WIDTH/2,HEIGHT/2)
end
function timer(t,callback)
tween.delay(t,function() callback() timer(t,callback) end)
end