diff --git a/automated_updates_data.json b/automated_updates_data.json index 2e22d59783d..c6745638638 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-07-01", + "summary": "Improved keyboard docs: added 'Any key released' and 'Key just pressed' conditions, clarified held-down vs single-frame checks, documented key names for text-expression conditions, and clarified the Last pressed key expression for rebinding" } ] } diff --git a/docs/gdevelop5/all-features/keyboard/index.md b/docs/gdevelop5/all-features/keyboard/index.md index a939ed6bcbe..9aecf028c2b 100644 --- a/docs/gdevelop5/all-features/keyboard/index.md +++ b/docs/gdevelop5/all-features/keyboard/index.md @@ -9,9 +9,17 @@ GDevelop gives access to all inputs made on the keyboard. This includes conditio For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed. +## Any key released + +The corresponding actions are performed on the frame where 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 key selected while setting this condition is pressed, 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. This is what you usually want for continuous movement. + +## Key just pressed + +The corresponding actions are performed only on the single frame where the key goes from released to pressed. Use this instead of "Key pressed" when an action should happen once per key press (for example jumping, firing a weapon, or toggling a menu), regardless of how long the key is held. ## Key released @@ -21,10 +29,14 @@ Whenever the key selected while setting this condition is released, the correspo 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. +This is useful when the key to check is not fixed, for instance when the player can remap their controls and the key name is stored in a variable. + !!! danger Make sure that the key name is surrounded by quotes. +Some commonly used key names are: `Space`, `Return` (the Enter key), `Escape`, `Left`, `Right`, `Up`, `Down`, `Shift` keys as `LShift`/`RShift`, `Control` keys as `LControl`/`RControl`, letters in lowercase (`a` to `z`), number row keys as `Num0` to `Num9` and numpad keys as `Numpad0` to `Numpad9`. When configuring the non-text-expression conditions, the dropdown list shows every key name that GDevelop recognises. + ![](/gdevelop5/all-features/annotation_2019-06-20_191229.png) ## Key released (text expression) @@ -33,9 +45,9 @@ To test a key release using this condition, you need to enter the key name in th ![](/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 latest key pressed on the keyboard, as a string. For example, if the last key press is the left arrow key, the expression will return "Left". This is handy for building a "press any key to rebind" screen: read this expression to capture whichever key the player pressed. ## Reference