Skip to content
Back to skills

Godot Input

ASecurity

Godot input: InputMap actions, gamepad and touch, mouse aim, rebinding saved at runtime; a jump that is missed or fires twice.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentspythongobashnode

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add tipoLi5890/game-studio --skill godot-input --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Godot Input?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Godot Input
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tipoli5890-godot-input/badge)](https://www.skillsdirectory.com/skills/tipoli5890-godot-input)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: godot-input
description: >-
  Godot input: InputMap actions, gamepad and touch, mouse aim, rebinding saved at runtime; a jump
  that is missed or fires twice.
---

# godot-input — actions, not devices

Gameplay reads actions; a gamepad, a touch overlay and a journey's scripted driver all fill the same ones.

## Situation → where to read

| Situation | Read |
|---|---|
| "The jump is missed sometimes", "it jumps twice", "it only fails at high frame rates" | *Missed or doubled jumps* below |
| Adding actions: `project.godot` text, `InputMap` at runtime, `ui_*`, deadzones, several pads | `reference/actions.md` |
| A struct the motor reads; a jump buffer; scripted input for an AI or a journey | *One reader* below, `resources/input_reader.gd` |
| Mouse look and mouse aim | `reference/actions.md` → "Mouse" |
| Phone play: an on-screen stick, touch buttons, several fingers | `reference/touch.md`, `resources/virtual_stick.gd` |
| "Press a key to rebind", conflicts, saving to `user://`, reset to defaults | `reference/rebinding.md`, `resources/rebind_store.gd` |
| A typo in an action name; an action nothing can press | `scripts/input_check.py` |

## Missed or doubled jumps

What the engine does with injected events, at `--fixed-fps` 30, 60 and 120 against the default
60 physics ticks:

- `Input.is_action_just_pressed` read in `_physics_process` is true in **exactly one tick per
  press**: not twice when a frame holds two ticks, not lost when a frame holds none. Read in
  `_process` it is true in exactly one frame.
- A tap pressed and released before the next event flush still reports `just_pressed` (and
  `just_released`) once, while `Input.is_action_pressed` is never true for it.
- `Input.parse_input_event` is buffered: the action changes at the next frame's flush.
  `Input.action_press` changes it at once and calls no `_input`.
- A key repeat arrives as an echo: the action stays pressed and `just_pressed` does not fire
  again; `InputEvent.is_action_pressed` ignores echoes unless `allow_echo` is true.

So a missed or doubled jump is the game's code. Six presses (four taps, one tap shorter than a
frame, one long hold) give these jump counts per pattern:

| How the jump is read | 30 fps | 60 fps | 120 fps |
|---|---|---|---|
| `is_action_just_pressed` polled in `_physics_process` | 6 | 6 | 6 |
| `input_reader.gd`: `consume_jump()` in `_physics_process` | 6 | 6 | 6 |
| `_process` sets `want = is_action_just_pressed(...)`, the tick jumps on `want` | **12** | 6 | **4** |
| the same, the tick clears `want` after jumping | 6 | 6 | **4** |
| `_unhandled_input` jumps on the event **and** the tick polls | **12** | **12** | **12** |
| `is_action_pressed` and on the floor | the short tap: **0**; the hold: jumps again on every landing |

The causes, in the order to suspect them:

1. **Two readers.** An `_input` or `_unhandled_input` handler and a poll both act on one press.
   One place reads the jump.
2. **A flag written every frame and read every tick.** Below the tick rate the next frame's two
   ticks both see it (doubled); above it a frame with no tick overwrites it with false before the
   tick comes (missed). Read in the tick, or latch it (`want = want or ...`) and clear it in the tick.
3. **Held instead of pressed.** `is_action_pressed` misses the short tap and re-jumps while held.
4. **The press came a few ticks before landing.** `just_pressed and is_on_floor()` drops it; a
   buffer (0.12 s in the reader) keeps it until the body lands.
5. **Something else writes `velocity` after the jump** in the same tick: a second writer
   (`godot-2d-controller`, `godot-3d-controller` own the motor).

## One reader

`resources/input_reader.gd` is a `Node` under the player. It samples the InputMap in
`_physics_process` at `process_physics_priority = -100`, so it runs before the motor in the same
tick, and exposes `move` (`Input.get_vector`, length ≤ 1), `jump_held`, `look` (captured mouse
motion this tick, radians) and `last_device`. The motor calls `consume_jump()` once per tick.

```gdscript
const InputReader = preload("res://input/input_reader.gd")
@onready var input: InputReader = $InputReader

func _physics_process(delta: float) -> void:
	if is_on_floor() and input.consume_jump():
		velocity.y = jump_velocity
	velocity.x = input.move.x * run_speed
	move_and_slide()
```

A journey or an AI sets `from_device = false` and calls `drive(move, jump_down)` each tick before
the motor; a rising edge of `jump_down` buffers a press exactly as a device does. A journey that
drives the real InputMap instead presses actions: `godot-play-harness`.

The reader checks its five action names in `_ready` and fails loudly (`ERROR:`) if one is
missing, instead of reading nothing for the rest of the run.

## Actions in short

- Name actions after intent (`jump`, `dash`, `move_left`), never after a key. Built-in `ui_*`
  actions exist in every project and drive Control focus; give gameplay its own.
- Define them in `project.godot` (`[input]`, one `Object(InputEvent...)` per event) or at
  runtime with `InputMap.add_action` and `InputMap.action_add_event`. A
  `ProjectSettings.set_setting("input/...")` alone does **not** register an action;
  `InputMap.load_from_project_settings` does, and it drops every action added at runtime.
- Bind keys by `InputEventKey.physical_keycode`: the key's place on a US QWERTY board, which
  keeps WASD where the fingers are on other layouts. Show its label with
  `DisplayServer.keyboard_get_label_from_physical`.
- A pad event with `device` -1 matches every pad; one with 0 matches only pad 0, which is how a
  second local player gets their own actions. Stick strength is rescaled past the deadzone:
  with 0.2, a stick at 0.3 reads 0.125 (`Input.get_action_raw_strength` still says 0.3).

The `project.godot` text, per-player actions, deadzones and mouse aim: `reference/actions.md`.

## Check it headless

```bash
python3 scripts/input_check.py /path/to/project            # FAIL per undefined name, exit 2
python3 scripts/input_check.py /path/to/project --strict   # actions with no event fail too
```

It reads `project.godot`, `InputMap.add_action` calls and every literal action name in `.gd`,
`.tscn` and `.tres` files (`Input`, `InputMap` and `InputEvent` calls, `get_axis`,
`get_vector`, `action = "..."` on a `TouchScreenButton`, `var action_* = &"..."` defaults) and
fails on a name no InputMap defines, with the nearest real name. The engine only reports a bad
name when the line runs (`ERROR: The InputMap action "jmup" doesn't exist.`), so a typo in a rare
branch survives every load check. Names built at runtime are counted as dynamic and not checked.

`input_check.py --selftest` runs the lint on fixtures, then this skill's resources in a temp
project headless: the timing table above, the buffer, `drive()`, mouse look, pad devices,
deadzones, echoes, the virtual stick and a rebinding saved in one process and loaded in the next.

## Discipline

- **Gameplay never calls `Input` directly.** It reads the reader, so a device, a touch overlay
  and a script are interchangeable and the motor is testable.
- **Sample in the tick that consumes.** Anything a physics motor uses is read in
  `_physics_process`; anything visual (camera look, UI) may read per frame.
- **Buffer presses, not holds.** A press lives for a fixed time and is used once; a hold is read
  fresh every tick.
- **One owner per action.** If a menu and the player both answer to `jump`, pausing must stop the
  player reading it (`godot-scene-flow` owns pause).
- **Every change ends with `godot-verify`** — and with `input_check.py` when an action name moved.

## Related skills

- Cameras and look input: `godot-camera`
- The motors that read the reader: `godot-2d-controller` · `godot-3d-controller`
- UI focus, menus, prompts that show the last device: `godot-ui`
- Scripted input in journeys: `godot-play-harness`
- Saving other settings next to the bindings: `godot-scene-flow`

Files in this skill

  • SKILL.md7.8 KB
  • reference/actions.md5.3 KB
  • reference/rebinding.md3.9 KB
  • reference/touch.md3.3 KB
  • resources/input_reader.gd4 KB
  • resources/rebind_store.gd7 KB
  • resources/virtual_stick.gd2.1 KB
  • scripts/input_check.py31.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.