API Reference › Input › Input.key_pressed
method

Input.key_pressed

Input.key_pressed(key) -> bool

Returns whether a key went down this frame — held now, not held last frame. A clean rising edge for one-shot actions (fire, confirm), distinct from the continuous Input.key_down.

Example

program Demo {
  entry {
    Input.press(' ')
    Input.poll()
    if Input.key_pressed(' ') { print(1) }
  }
}
← All symbols