diff --git a/automated_updates_data.json b/automated_updates_data.json index b2d10e2b2e4..8219a5cfc03 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -92,6 +92,10 @@ { "date": "2026-04-22", "summary": "Improved resources-loading docs (named Preload scene action, documented SceneLoadingProgress expression and AreSceneAssetsLoaded condition, clarified custom loading screen approach) and added extension lifecycle functions table to events/functions docs" + }, + { + "date": "2026-06-07", + "summary": "Improved keyboard docs: added 'Key just pressed' and 'Any key released' conditions, clarified held-vs-just-pressed behaviour, added touch-device caveat and a full list of valid key names" } ] } diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcbe..0faca9c41f0 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -3,19 +3,31 @@ title: Keyboard --- # Keyboard -GDevelop gives access to all inputs made on the keyboard. This includes conditions to check if a key was pressed or released. +GDevelop gives access to all inputs made on the keyboard. This includes conditions to check if a key is pressed or released. + +!!! warning + + Keyboard conditions do not work with the on-screen keyboard on touch devices. When making a game for mobile or touchscreen devices, use the mouse/touch conditions instead. ## Any key pressed -For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. +The corresponding actions will be performed if any key on the keyboard is pressed. + +## Any key released + +The corresponding actions will be performed when any key on the keyboard is released. ## Key pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +Whenever the selected key is held down, the corresponding actions are performed. This condition stays true for as long as the key is held down, so the actions run on every frame until the key is released. + +## Key just pressed + +The corresponding actions are performed only on the single frame where the key goes from released to pressed. Use this when you want an action to happen once per key press (for example, jumping or firing) rather than continuously while the key is held. ## Key released -Whenever the key selected while setting this condition is released, the corresponding actions are performed. +Whenever the selected key is released, the corresponding actions are performed. ## Key pressed (text expression) @@ -35,7 +47,21 @@ To test a key release using this condition, you need to enter the key name in th ## Last key pressed -"Last key pressed" expression returns the last key press in the form of a string. For example, if the last key press is the left arrow key, the expression will return "Left". +The "Last pressed key" expression returns the name of the latest key pressed on the keyboard, as text. For example, if the last key press is the left arrow key, the expression will return "Left". This is useful for building features like remappable controls, where you let the player press a key and store its name. + +## Key names + +When a condition or expression asks for a key name as text, use one of these values (case-sensitive): + +* **Letters:** `a` to `z` +* **Digits (top row):** `Num0` to `Num9` +* **Numpad digits:** `Numpad0` to `Numpad9` +* **Arrows:** `Left`, `Up`, `Right`, `Down` +* **Modifiers:** `LShift`, `RShift`, `LControl`, `RControl`, `LAlt`, `RAlt`, `LSystem`, `RSystem` (the left/right Windows or Command key) +* **Function keys:** `F1` to `F12` +* **Editing keys:** `Space`, `Return`, `Back` (Backspace), `Tab`, `Delete`, `Insert`, `Escape`, `Home`, `End`, `PageUp`, `PageDown`, `Pause`, `Menu` +* **Punctuation:** `SemiColon`, `Comma`, `Period`, `Quote`, `Slash`, `BackSlash`, `Equal`, `Dash`, `LBracket`, `RBracket`, `Tilde` +* **Numpad keys:** `Add`, `Subtract`, `Multiply`, `Divide`, `NumpadReturn`, `NumpadHome`, `NumpadEnd`, `NumpadPageUp`, `NumpadPageDown`, `NumpadLeft`, `NumpadUp`, `NumpadRight`, `NumpadDown` ## Reference