Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions automated_updates_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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-05-12",
"summary": "Improved keyboard docs: clarified Key pressed vs. Key just pressed distinction, added Any key released and LastPressedKey expression usage, and documented the full set of valid key names for text-expression conditions"
}
]
}
40 changes: 24 additions & 16 deletions docs/gdevelop5/all-features/keyboard/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,45 @@ 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
!!! note

For this condition, the corresponding action/s will be performed if any key on the keyboard is pressed.
Keyboard conditions don't work with the on-screen keyboard on touch devices. For mobile or touch-screen games, use mouse/touch conditions instead (or display a virtual keyboard with a [Text Input](/gdevelop5/objects/text_input) object).

## 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 distinct conditions to detect a key press, and choosing the right one matters:

## Key released
- **Key pressed**: stays true *every frame* the key is held down. Use it for continuous actions, like moving a character while an arrow is held.
- **Key just pressed**: only true on the *single frame* the key starts being pressed. Use it for one-shot actions, like firing a bullet, jumping, or toggling a menu — this prevents the action from triggering repeatedly while the key is held.

Whenever the key selected while setting this condition is released, the corresponding actions are performed.
A similar **Key released** condition is true on the frame the key is released.

## Key pressed (text expression)
## Any key pressed / 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.
These conditions are true on the frame any key on the keyboard starts being pressed or is released. They're useful for "Press any key to continue" screens.

!!! danger
## Last pressed key

Make sure that the key name is surrounded by quotes.
The `LastPressedKey()` expression returns the name of the most recently pressed key as text. This is convenient for building a key-rebinding screen: ask the player to press a key, then store `LastPressedKey()` in a variable to use later in a "Key pressed (text expression)" condition.

![](/gdevelop5/all-features/annotation_2019-06-20_191229.png)
## Valid key names

## Key released (text expression)
When using the text-expression variants of the conditions (or comparing against `LastPressedKey()`), the key name must be written exactly — names are **case-sensitive**:

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: `a` to `z` (lowercase).
- Top-row digits: `Num0` to `Num9`. Numpad digits: `Numpad0` to `Numpad9`.
- Arrows: `Left`, `Right`, `Up`, `Down` (numpad arrows: `NumpadLeft`, `NumpadRight`, `NumpadUp`, `NumpadDown`).
- Function keys: `F1` to `F12`.
- Modifiers: `LShift`, `RShift`, `LControl`, `RControl`, `LAlt`, `RAlt`, `LSystem`, `RSystem` (the system/meta key, like Windows or Command).
- Common keys: `Space`, `Return`, `Tab`, `Back` (backspace), `Escape`, `Delete`, `Insert`, `Home`, `End`, `PageUp`, `PageDown`, `Pause`, `Menu`.
- Punctuation: `SemiColon`, `Comma`, `Period`, `Quote`, `Slash`, `BackSlash`, `Equal`, `Dash`, `LBracket`, `RBracket`, `Tilde`.
- Numpad operators: `Add`, `Subtract`, `Multiply`, `Divide` (also available as `NumpadAdd`, `NumpadSubtract`, `NumpadMultiply`, `NumpadDivide`, `NumpadReturn`, etc.).

![](/gdevelop5/all-features/annotation_2019-06-20_191302.png)
!!! danger

## Last key pressed
Always surround the key name with quotes in the expression field, e.g. `"Left"`, not `Left`.

"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".
![](/gdevelop5/all-features/annotation_2019-06-20_191229.png)

## Reference

Expand Down