An implementation of both setTimeout and setInterval from JS in GameMaker Studio 2.3
- Copy
setTimeout
,setInterval
, andsetManager
into your project - Create an instance of the
setManager
at game start (alternatively, call__INTERVAL_UPDATE__
and__TIMEOUT_UPDATE__
every frame) - Create an timeout or interval using
setTimeout
/setInterval
respectively - Use
clearTimeout
/clearInterval
to stop them from running
- Callback functions have an
arguments
variable which is an array of arguments that are passed to the callback from the initalsetTimeout
/setInterval
functions setTimeout
/setInterval
return a numerical ID which can be passed intoclearTimeout
/clearInterval
to stop them from running