isButtonDown(btn?: TButton | TButton[]): boolean

If any or certain bound button(s) are currently held down on any input (keyboard, gamepad).

parambtn- The button(s) to check.

onUpdate(() => {
    if (!isButtonDown()) return // early return as no button is held down

    if (isButtonDown("jump")) debug.log("Player is jumping")
    if (isButtonDown(["left", "right"])) debug.log("Player is moving")
})

sincev3001.0

kaplay logo

Misc

Layer