
Input Keyboard Mouse Touch
This covers Phaser 4's unified input system, the part of the framework you'll interact with constantly for any game with user controls. It walks through keyboard polling with cursor keys and addKey, pointer events for clicks and taps, making Game Objects interactive with setInteractive (including pixel-perfect hit testing), and the full Pointer API with properties like isDown, worldX/worldY, and button states. The source code references are solid (InputPlugin.js, KeyboardPlugin.js, Pointer.js) and the examples show both event-driven and polling patterns. Gamepad support is mentioned but not deeply documented here. If you're building anything beyond a purely reactive game, you'll need the keyboard polling patterns and the distinction between global pointer events versus per-object interactive handlers.
- skills.sh installs
- 1.1K
- GitHub stars
- 40.7K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add phaserjs/phaser --skill input-keyboard-mouse-touch --agent claude-codeInstalls into .claude/skills of the current project.
Files
Input: Keyboard, Mouse, Touch, and Gamepad
Phaser provides a unified input system accessed via
this.inputin any Scene. It supports keyboard polling and events, mouse/pointer interaction with Game Objects (click, hover, drag), multi-touch, mouse wheel, and gamepad input. Input can be handled through event listeners or by polling state each frame.
Key source paths: src/input/InputPlugin.js, src/input/Pointer.js, src/input/keyboard/KeyboardPlugin.js, src/input/keyboard/keys/Key.js, src/input/keyboard/keys/KeyCodes.js, src/input/keyboard/combo/KeyCombo.js, src/input/gamepad/GamepadPlugin.js, src/input/gamepad/Gamepad.js, src/input/events/, src/input/keyboard/events/
Related skills: ../sprites-and-images/SKILL.md, ../events-system/SKILL.md, ../scenes/SKILL.md
Quick Start (basic keyboard + pointer input)
class MyScene extends Phaser.Scene {
create() {
// Keyboard: create cursor keys (up, down, left, right, space, shift)
this.cursors = this.input.keyboard.createCursorKeys();
Sponsors
Details
- Repository
- github.com/phaserjs/phaser
- First seen
- Jun 3, 2026