isKeyPressed(k?: Key | Key[]): boolean

If any or certain key(s) are just pressed last frame.

paramk- The key(s) to check.

onUpdate(() => {
    if (!isKeyPressed()) return // early return as no key was pressed

    if (isKeyPressed("space")) debug.log("Pressed the jump key")
    if (isKeyPressed(["left", "right"])) debug.log("Pressed any of the move keys")
})

sincev2000.0

kaplay logo

Misc

Layer