Syntax
Pauses the current code for a number of seconds of game time. The Engine keeps drawing frames during the wait.
Wait(<seconds>)Parts
| <seconds> | The length of the wait in seconds. Decimals are accepted: 0.5 is half a second. |
|---|
Good to know
- It counts game time: it stops while the game is paused and follows the time scale.
Waitcounts seconds, Sleep() counts milliseconds. In DarkBASICWAITcounts milliseconds: here Wait(1000) lasts about 16 minutes.- Refused inside a
FUNCTIONand after the top-levelLOOP. Allowed beforeDO, inside the loop, in a straight program and in a label. - It is a statement.
x = Wait(1)compiles, then the program stops on that line withWait is not defined. - In a program without
DO, one Wait() anywhere, even in a label, turns the whole program into a single main program: lifecycle functions such asupdateare no longer found. - Inside a task, it is a point where
CANCELTASKstops the task.
Example
Console("3") ' 3Wait(1)Console("2") ' 2Wait(0.5)Console("go") ' goIn the manual : The game loop and tasks