From ec7c3d9fa0fb9fd1abe823c61bad126209b853c2 Mon Sep 17 00:00:00 2001 From: 4ian <1280130+4ian@users.noreply.github.com> Date: Mon, 29 Jun 2026 11:50:02 +0000 Subject: [PATCH] [Auto] [Improve] Clarified keyboard "key pressed" vs "just pressed", touch limits, and key remapping --- automated_updates_data.json | 4 +++ docs/gdevelop5/all-features/keyboard/index.md | 29 ++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/automated_updates_data.json b/automated_updates_data.json index f4814526d15..6a7422ee794 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-29", + "summary": "Improved keyboard docs: explained Key pressed vs Key just pressed, added Any key released, noted touch-device limitation, clarified text-expression key and Last pressed key for remapping" } ] } diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcbe..5ca2588e0ac 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -3,23 +3,30 @@ 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. -## Any key pressed +!!! warning -For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. + These conditions do not work with the on-screen keyboard shown on touch devices. When making a game for mobile/touchscreen devices, use the [mouse/touch](/gdevelop5/all-features/mouse-touch) conditions instead, or the [Text Input](/gdevelop5/objects/text_input) object to capture typed text. -## Key pressed +## Key pressed vs Key just pressed -Whenever the key selected while setting this condition is pressed, the corresponding actions are performed. +There are two similar conditions, and choosing the right one matters: + +* **Key pressed** stays true for *every frame* during which the key is held down. Use it for continuous actions, like moving a character as long as an arrow key is held. +* **Key just pressed** is only true for the *single frame* on which the key was first pressed. Use it for one-time actions that should not repeat while the key stays down, such as making a character jump or toggling a menu. + +## Any key pressed / Any key released + +These conditions are true when any key on the keyboard is pressed (or just released). They are handy to dismiss a screen or start a game with "press any key". ## Key released Whenever the key selected while setting this condition is released, the corresponding actions are performed. -## Key pressed (text expression) +## Choosing the key -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. +When setting up a key condition you pick the key from a list. The condition can also be configured to take the key name as a **text expression**, which is useful when the key to check is stored in a variable (for example, for customizable controls). For example, to check the left arrow key, enter "Left" in the field. !!! danger @@ -27,15 +34,11 @@ To test a key press using this condition, you need to enter the key name in the ![](/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. - ![](/gdevelop5/all-features/annotation_2019-06-20_191302.png) -## 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 a string. For example, if the last key pressed is the left arrow key, the expression returns "Left". This is convenient to let the player remap their controls by capturing whichever key they press next. ## Reference