An implementation of both setTimeout and setInterval from JS in GameMaker Studio 2.3
- Copy
setTimeout,setInterval, andsetManagerinto your project - Create an instance of the
setManagerat game start (alternatively, call__INTERVAL_UPDATE__and__TIMEOUT_UPDATE__every frame) - Create an timeout or interval using
setTimeout/setIntervalrespectively - Use
clearTimeout/clearIntervalto stop them from running
- Callback functions have an
argumentsvariable which is an array of arguments that are passed to the callback from the initalsetTimeout/setIntervalfunctions setTimeout/setIntervalreturn a numerical ID which can be passed intoclearTimeout/clearIntervalto stop them from running