Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Input
/
Keyboard
Phaser 4.1.0
Phaser 4 examples
Keyboard
22
examples
Examples
22
Add Key
Demonstrates how to create specific Key objects using KeyCodes and poll their state within the update loop to detect if a key is currently pressed.
Add Multiple Keys via String
Demonstrates how to register multiple keyboard keys simultaneously using a single comma-separated string and check their state in the update loop.
Arcade Name Entry
Create a classic high-score name entry screen that supports both keyboard navigation and pointer interaction using bitmap text and grid snapping.
Create Key Combo
Detect a specific sequence of key presses (a combo) and trigger an event when the sequence is completed successfully.
Cross Scene Keyboard Events
Demonstrates how keyboard events propagate across multiple active scenes running in parallel and explores the hierarchy of local Key events versus global keyboard listeners.
Cursor Key Timing Data
Demonstrates how to access timing and duration properties for cursor keys, including timeDown, timeUp, and current press duration while controlling a physics-enabled sprite.
Cursor Keys
Control a physics-enabled sprite using the standard keyboard arrow keys via the built-in cursor keys helper.
Global Keydown Event
Demonstrates how to capture every keyboard key press globally within a Scene using the keyboard manager's event listener.
Key Combo Max Key Delay
Demonstrates how to set a time limit between key presses for a key combo, resetting the sequence if the delay is exceeded.
Key Down Delay
Demonstrates how to use the checkDown method to apply a custom rate-limit or delay to keyboard input, controlling how often an action triggers while a key is held down.
Key Down Duration
Demonstrates how to use the getDuration method to track exactly how long a specific keyboard key has been held down in milliseconds.
Key Just Down
Demonstrates the JustDown function, which triggers an action exactly once when a key is first pressed, preventing repeated execution if the key is held.
Key Modifiers
Detect if modifier keys such as Shift, Control, or Alt are being held down when a specific key event is triggered.
Keyboard Event Listeners and Propagation
Demonstrates three ways to detect a single key press: via a Key object listener, a specific keycode global event, and a generic keyboard event, while showing how stopPropagation controls the flow between them.
Keyboard Events and Polling
Demonstrates different ways to handle keyboard input: using global event listeners, specific key-down and key-up events, and creating Key objects for direct polling in the update loop.
Konami Code Key Combo
Detect a specific sequence of key presses using the Keyboard Key Combo system and trigger an event when the sequence is completed.
Multi-Scene Keyboard Events
Demonstrates how to handle keyboard input across different scenes, showing how input listeners function when scenes are paused, resumed, or running concurrently.
Numpad Input
Listen for specific keydown events from the numeric keypad (numpad) to trigger actions in your game.
Reset Key Combo On Match
Demonstrates how to use the resetOnMatch property to allow a keyboard combo to be triggered multiple times repeatedly.
Retro Leaderboard Name Entry
A classic arcade-style high score name entry system using grid-based character selection. Demonstrates keyboard arrow navigation, mouse interaction, direct key-to-character mapping, and event-based communication between Scenes.
Single Keydown Event
Demonstrates how to listen for specific keyboard press events using string-based event names like 'keydown-A' and 'keydown-SPACE', including how to capture keys to prevent default browser scrolling.
Text Entry
Demonstrates how to capture keyboard input to create a simple text entry system, including handling backspace and alphanumeric characters.