Easiest way to make a repeater

So basicly you do this. lets call the thing you want to do “D” and you want it to repeat every 3 seconds you will do

function setup()
function draw()
if D== 180 then D= 0 end

Now after that if you want like a flashing text,flashing numbers,… every 3 sec you start out like this

if D== 0 then

@Mnkj78lg: you could also use general purpose timer code. I’ve written some that you can grab here: https://gist.github.com/apendley/5382684

To start using it you simply need to put this in your setup:

timer = createTimer()

and this in your draw:


Then, from anywhere in your program, you can create a timer that calls a function after a repeating interval:

-- set a repeating timer for 3 seconds
timer(3, 0, function(t)

Yea toadkick your code is much more optimised solution. What if you got a lot of code or if your system is slower then one other, then on one unit a second will be faster then the other. By using the DeltaTime your calculation is much more accurate.

Or you could use

if math.fmod(D,180)==0 then
--do your flashing stuff

D can be the universal counter and different objects can be made to flash at different rates by changing the second value in the fmod function

Oh I didn’t think of that that way