input-keyboard-mouse-touch

Implement keyboard, mouse, touch, drag-and-drop, and gamepad input handling in Phaser 4 scenes.

Updated Jun 10, 2026
One-click install
npx skills add https://github.com/mudman1986/quarterless --skill input-keyboard-mouse-touch-mudman1986
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: input-keyboard-mouse-touch
Source: https://github.com/mudman1986/quarterless/tree/main/.github/skills/input-keyboard-mouse-touch
Command: npx skills add https://github.com/mudman1986/quarterless --skill input-keyboard-mouse-touch-mudman1986

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Handling user input in Phaser games requires knowing many APIs: keyboard polling versus events, pointer coordinates, hit areas, drag-and-drop, multi-touch, and gamepads. This Skill consolidates the complete Phaser 4 input system into one reference so you can wire up controls correctly without digging through source files. ## Core Features & Use Cases - Keyboard Input: Create cursor keys, register individual keys with addKey/addKeys, poll with isDown or JustDown, listen to keydown events, and build key combos like the Konami code. - Pointer and Touch: Handle clicks, hover, mouse wheel, pointer lock, multi-touch with up to 10 pointers, and camera-translated world coordinates. - Interactive Objects and Drag-and-Drop: Make Game Objects clickable with setInteractive, define geometric or pixel-perfect hit areas, and implement drag-and-drop with drop zones. - Gamepad Support: Poll sticks, buttons, and D-pad, listen for connect/disconnect events, and trigger vibration. - Use Case: You are building a platformer and need WASD movement, clickable UI buttons, and draggable inventory items. This Skill gives you the exact event names, callback signatures, and config options for each. ## Quick Start Ask the AI to show how to make a Phaser sprite clickable and draggable while also polling arrow keys for movement in the update loop.

Frequently Asked Questions about input-keyboard-mouse-touch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle keyboard input in Phaser?

Use this.input.keyboard.createCursorKeys() for arrow keys or addKey('W') for specific keys, then poll key.isDown in update(). For one-time presses use Phaser.Input.Keyboard.JustDown(key), or listen to 'keydown-SPACE' style events.

How to make a sprite clickable in Phaser?

Call sprite.setInteractive() to enable input using the texture frame as the hit area, then listen with sprite.on('pointerdown', callback). You can pass custom geometric shapes or enable pixel-perfect hit testing via the config object.

How do I implement drag and drop in Phaser?

Call setInteractive() on the object, then this.input.setDraggable(sprite) or use { draggable: true } in the config. Listen for 'dragstart', 'drag', and 'dragend' events, and create drop zones with zone.setRectangleDropZone() to receive 'drop' events.

Does Phaser support gamepad input?

Yes, enable it with input: { gamepad: true } in the game config, then access pads via this.input.gamepad.pad1 through pad4. Note that browsers require HTTPS and usually a button press before exposing the gamepad.

Why is my Phaser pointerdown event not firing on a Game Object?

The most common cause is forgetting to call setInteractive() on the object first. Containers additionally need setSize() or an explicit hit area shape, and input events do not fire during the preload phase.

Why does JustDown only work once in Phaser?

Phaser.Input.Keyboard.JustDown consumes the flag when read, so calling it twice in one frame returns true then false. Store the result in a variable if you need the value in multiple places.