What problem does it solve?
Phaser 4's input system is complex, spanning keyboard, mouse, touch, pointer, drag-and-drop, hit areas, interactive objects, and gamepad. This skill provides a unified input layer that centralizes handling across scenes, making it easier to respond to user actions consistently.
Core Features & Use Cases
- Unified input API accessed via this.input for per-scene and per-object events.
- Keyboard: createCursorKeys, addKey/addKeys, event listeners, and key combos.
- Pointer & Game Object events: pointerdown/over/move on interactive objects and scene-level pointer events.
- Drag and Drop: draggable objects, drag events, and drop zones.
- Hit testing: configurable hit areas (rectangles, circles, polygons) and pixel-perfect options.
- Gamepad support: plug-in style gamepad input, axes and buttons.
- Pointer lock and multi-pointer support: pointer lock usage and additional pointers.
Quick Start
Create a Scene, set up interactive objects with setInteractive(), and start listening for keyboard and pointer events.