0

There is no built in sleep function in gml, is there a way to do a sleep function without using alarms?

  • Where do you need a sleep function for? I'm thinking about the classic `System.Threading.Thread.Sleep()` Method from Windows Forms, which I didn't found useful myself. – Steven Jan 25 '18 at 15:04

2 Answers2

0

Late reply, but if this is for "freeze frames" (short pauses to accent impact), this can be done via a busy loop:

/// busysleep(ms)
var t = current_time + argument0;
while (current_time < t) { }
YellowAfterlife
  • 2,967
  • 1
  • 16
  • 24
0

Create the variables sleepStart and count, then set them to 0. Within step, begin step, or end step, add the code:

if (sleepStart==1){count+=1}
if (count==90){//That number can be whatever you want, depending on the length you want the delay.
//Code to be executed after specified number of steps here.
}

When you want to start the delay, set sleepStart to 1.

In case you don't know, 90 steps would be 3 seconds at the default room speed of 30.

Programmer S
  • 429
  • 7
  • 21