Skip to content

Control functions

Free functions you can call directly in sprite code.

createClone(data?: unknown): void

Create a clone of this sprite, optionally passing data to the clone start handler.

Delegates to Sprite.createClone

deleteThisClone(): void

Delete this clone.

Delegates to Sprite.deleteThisClone

forever(body: () => void): void

Run a block of code in an infinite loop.

Pauses the script (a generator). In sprite code the free-function wrapper awaits it for you.

repeat(times: number, body: () => void): void

Run a block of code a fixed number of times.

Pauses the script (a generator). In sprite code the free-function wrapper awaits it for you.

stop(option: "stopScript" | "stopSprite" | "stopOtherScripts"): void

Stop scripts according to the given option.

Delegates to Sprite.stop

untilLoop(condition: () => boolean, body: () => void): void

Repeat a block of code until the condition becomes true.

Pauses the script (a generator). In sprite code the free-function wrapper awaits it for you.

wait(seconds: number): void

Pause this script for the given number of seconds.

Pauses the script (a generator). In sprite code the free-function wrapper awaits it for you.

Delegates to Sprite.wait

warp(procedure: () => void): void

Run a procedure without screen refresh (warp speed).

Delegates to Sprite.warp