From 4641ca23adb65ea57cab8eaf4802135bc82da1cc Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:11:00 +0000 Subject: [PATCH] [Auto] [Improve] Clarified keyboard 'Key pressed' vs 'Key just pressed' and added valid key names list --- automated_updates_data.json | 4 +++ docs/gdevelop5/all-features/keyboard/index.md | 35 ++++++++++--------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/automated_updates_data.json b/automated_updates_data.json index f4814526d15..ed79df56cb4 100644 --- a/automated_updates_data.json +++ b/automated_updates_data.json @@ -96,6 +96,10 @@ { "date": "2026-06-24", "summary": "Improved window docs: distinguished game resolution from window size, documented resize mode and auto-adapt, added center window and window icon actions, and listed scene/screen size expressions" + }, + { + "date": "2026-06-26", + "summary": "Improved keyboard docs: distinguished 'Key pressed' (held) from 'Key just pressed' (single frame), explained dropdown vs text-expression key parameters, and added a 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..37e8a1388b5 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -5,37 +5,40 @@ title: Keyboard GDevelop gives access to all inputs made on the keyboard. This includes conditions to check if a key was pressed or released. -## Any key pressed +## Any key pressed / Any key released -For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. +These conditions are true if any key on the keyboard is pressed (or released). This is useful, for example, to detect a "Press any key to start" screen. ## Key pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +This condition is true **as long as the chosen key is held down**, so the actions inside it run on every frame while the key stays pressed. Use it for continuous movement, like moving a character while an arrow key is held. -## Key released - -Whenever the key selected while setting this condition is released, the corresponding actions are performed. +You can pick the key from a dropdown list, or switch the parameter to a text expression and type the key name yourself (see the list of key names below). Typing the name is handy when the key is decided dynamically, for example from a variable used as a remappable control. -## Key pressed (text expression) +## Key just pressed -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. +Unlike "Key pressed", this condition is only true **for the single frame the key goes down**. It will not stay true while the key is held. Use it for one-shot actions like jumping, confirming a menu, or firing a single shot per press. -!!! danger +## Key released - Make sure that the key name is surrounded by quotes. +This condition is true for the single frame the chosen key is released. -![](/gdevelop5/all-features/annotation_2019-06-20_191229.png) +## Key names -## Key released (text expression) +When entering a key name as a text expression, the name must be surrounded by quotes (for example `"Left"`). The names are **case-sensitive**, and letter keys use a single lowercase letter (`"a"` to `"z"`). Some commonly used names: -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. +- **Letters and digits**: `"a"`–`"z"`, `"Num0"`–`"Num9"` (top row), `"Numpad0"`–`"Numpad9"` +- **Arrows**: `"Left"`, `"Up"`, `"Right"`, `"Down"` +- **Modifiers**: `"LShift"`, `"RShift"`, `"LControl"`, `"RControl"`, `"LAlt"`, `"RAlt"`, `"LSystem"`, `"RSystem"` (the left/right Windows or Command key) +- **Editing and navigation**: `"Space"`, `"Return"`, `"Tab"`, `"Back"` (Backspace), `"Delete"`, `"Insert"`, `"Escape"`, `"Home"`, `"End"`, `"PageUp"`, `"PageDown"` +- **Function keys**: `"F1"` to `"F12"` +- **Punctuation**: `"Comma"`, `"Period"`, `"SemiColon"`, `"Slash"`, `"BackSlash"`, `"Quote"`, `"Equal"`, `"Dash"`, `"LBracket"`, `"RBracket"`, `"Tilde"` -![](/gdevelop5/all-features/annotation_2019-06-20_191302.png) +The dropdown of the condition lists every supported key name. -## Last key pressed +## Last pressed key -"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 most recently pressed key as text, using the same names as above. For example, if the last key pressed was the left arrow, the expression returns `"Left"`. This is the easiest way to build a "press a key to bind it" controls menu. ## Reference