From afe95b3da750e2833b2fd8fad390693e07fe18d2 Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Thu, 12 Mar 2026 10:24:38 +0000 Subject: [PATCH] [Auto] [Improve] Added missing keyboard conditions, key names table, and touch-device warning --- automated_updates_data.json | 4 ++ docs/gdevelop5/all-features/keyboard/index.md | 60 +++++++++++++++---- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/automated_updates_data.json b/automated_updates_data.json index a12f40c349e..c8d1def9f27 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -72,6 +72,10 @@ { "date": "2026-03-10", "summary": "Filled in the 'Concepts used in Physics' section of the 3D Physics Engine docs: world/gravity/scale, body types, collision shapes (Box/Capsule/Sphere/Cylinder/Mesh), body settings, collision layers & masks, and movement (forces/impulses/velocities)" + }, + { + "date": "2026-03-12", + "summary": "Improved keyboard docs: added missing 'Key just pressed' condition, 'Any key released', touch-device warning, pressed-vs-just-pressed usage guidance, and a key names reference table" } ] } diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcbe..8aac77b08e3 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -3,40 +3,76 @@ 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 was pressed, just pressed, or released, and an expression to get the last key pressed. -## Any key pressed +!!! note -For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. + Keyboard conditions do **not** work with the on-screen keyboard on touch devices. Use [mouse/touch conditions](/gdevelop5/all-features/mouse-touch) instead when targeting mobile or touchscreen devices. ## Key pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +Checks if a key is **currently held down**. This condition stays true for every frame the key remains pressed — from the first frame it's pressed until the frame it's released. It is ideal for continuous actions like movement. + +## Key just pressed + +Checks if a key was pressed **during the current frame only**. This condition is true for exactly one frame: the frame the key first goes down. Use this when you want an action to fire once per key press, such as jumping, firing a bullet, or toggling a menu. + +!!! tip + + Use **Key pressed** for smooth continuous movement (e.g. holding a direction key), and **Key just pressed** when you need to react to a single press (e.g. jumping, interacting with an object). ## Key released -Whenever the key selected while setting this condition is released, the corresponding actions are performed. +Checks if a key was **just released** during the current frame. Like "Key just pressed", this is only true for one frame. -## Key pressed (text expression) +## Any key pressed + +True if **any** key on the keyboard is currently held down. + +## Any key released -To test a key press using this condition, you need to enter the key name in the form of text expression. For example, if you want to check condition for left arrow key press, you need to enter "Left" in the field. +True if **any** key on the keyboard was just released this frame. This is useful for letting the player press any key to continue past a loading screen or title card. + +## Key pressed (text expression) -!!! danger +The same as **Key pressed**, but the key name is entered as a **text expression** rather than chosen from a list. This is useful when the key name is stored in a variable or computed at runtime. - Make sure that the key name is surrounded by quotes. +For example, entering `"Left"` checks if the left arrow key is held. The key name must be surrounded by quotes. ![](/gdevelop5/all-features/annotation_2019-06-20_191229.png) ## Key released (text expression) -To test a key release using this condition, you need to enter the key name in the form of text expression. For example, if you want to check condition for left arrow key release, you need to enter "Left" in the field. +The same as **Key released**, but the key name is given as a text expression. ![](/gdevelop5/all-features/annotation_2019-06-20_191302.png) ## 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 expression `LastPressedKey()` returns the name of the most recent key pressed, as a string (e.g. `"Space"`, `"Left"`, `"a"`). This is useful for remapping controls or displaying the last input. + +## Key names + +Key names used in the text-expression conditions: + +| Key | Name | +|---|---| +| Arrow keys | `Left`, `Up`, `Right`, `Down` | +| Letters | `a`–`z` (lowercase) | +| Top-row numbers | `Num0`–`Num9` | +| Numpad numbers | `Numpad0`–`Numpad9` | +| Function keys | `F1`–`F12` | +| Space | `Space` | +| Enter / Return | `Return` | +| Backspace | `Back` | +| Escape | `Escape` | +| Tab | `Tab` | +| Delete | `Delete` | +| Insert | `Insert` | +| Left/Right Shift | `LShift`, `RShift` | +| Left/Right Control | `LControl`, `RControl` | +| Left/Right Alt | `LAlt`, `RAlt` | ## Reference -All actions, conditions and expressions are listed in [the keyboard reference page](/gdevelop5/all-features/keyboard/reference/). \ No newline at end of file +All actions, conditions and expressions are listed in [the keyboard reference page](/gdevelop5/all-features/keyboard/reference/).