Function

wait

(n: number, action?: () => void): TimerController

Run the function after n seconds.

param n- The time to wait in seconds.

param action- The function to run.

// 3 seconds until explosion! Runnn!
wait(3, () => {
    explode()
})

// wait() returns a PromiseLike that can be used with await
await wait(1)

returns A timer controller.

since v2000.0

group Timer

kaplay logo

Layer

Miscalenous