Hi, I made a pause/wait function. Feel free to use.
timer=1 p=0 function _update() pause(5)--Wait 5/30 frames then do what is in the if loop if timer==1 then end end function pause(p) if timer>p then timer=0 end timer+=1 end |
P#95724 2021-08-06 19:14 ( Edited 2021-08-06 19:18)
or having support for multiple timers:
function pause(t0,autoreset) local t=t0 return function() t-=1 if t==0 then if(autoreset) t=t0 return true end end end — new timer t1=pause(5,true) t2=pause(10) function _update() if t1() then printh(“do something (and again)“) end if t2() then printh(“do another thing :)”) end end |
P#95798 2021-08-09 07:34 ( Edited 2021-08-09 07:36)
[Please log in to post a comment]