API Reference › Input › Input.action
method

Input.action

Input.action(action: str, key: int) -> void

Registers a default keyboard binding: it binds key to the action only if the action has no key bound yet. Ship your defaults with Input.action in a Boot handler; a player's later Input.rebind (or a loaded key-map) is not clobbered, and re-running the defaults is idempotent. Combine with Input.bind_pad for a device-agnostic action, and read it with Input.active.

Example

program Defaults {
  entry {
    Input.action("jump", ' ')
    if Input.active("jump") { print(1) }
  }
}
← All symbols