The
Keyboard object allows projects to respond to keyboard input.
Note on the modern web it is naïve to assume all users have a keyboard. Many users now browse the web with touch-screen devices that have no keyboard. (The Keyboard object also does not respond to input from on-screen keyboards on any modern touch devices.) Therefore if your game uses exclusively mouse or keyboard control, it is impossible to use on touch devices. See the
Touch controls tutorial for an alternative control system.
Browser shortcut keys
In some browsers, some keys are shortcuts for browser actions. For example, space bar sometimes is a shortcut to scroll down the page. If any events exist for 'On key pressed' with a given key, Construct 2 blocks the browser from performing its normal action. For example, if you wish to prevent space bar scrolling down the page, add an empty 'On Space pressed' event, if you don't have one already.
Keyboard conditions
Key is downTrue if a given keyboard key is currently being held down.
On any key pressedTriggered when any keyboard key is pressed. Useful for title screens or cutscenes.
On key pressedTriggered when a specific keyboard key is pressed.
On key releasedTriggered when a specific keyboard key is released.
Keyboard actions
The Keyboard object does not have any actions.
Keyboard expressions
The Keyboard object does not have any expressions.