input-keyboard-mouse-touch

Consolidates Phaser 4 keyboard, mouse, touch, pointer, drag-drop hit area and gamepad input handling into one scene-scoped API.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill input-keyboard-mouse-touch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: input-keyboard-mouse-touch
Source: https://github.com/Raphe-dev/phaser-cozy-mmo/tree/main/skills/input-keyboard-mouse-touch
Command: npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill input-keyboard-mouse-touch

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Phaser developers frequently juggle inputs from keyboard, mouse, touch, pointer, drag-and-drop, hit areas, and gamepad across scenes. This Skill provides a unified input system exposed as this.input, covering polling, events, and per-object interaction to simplify building responsive, interactive games.

Core Features & Use Cases

  • Unified Input Plugin: access keyboard, pointer, mouse, touch, and gamepad within a single API per Scene.
  • Pointer, Drag & Hit Testing: manage multiple pointers, draggable objects, custom hit areas, and pixel-perfect hit tests for interactive sprites.
  • Keyboard & Gamepad: create keys, combos, capture keys to prevent browser defaults, and handle cross-device input in gameplay logic.
  • Event model: three levels of pointer events (per-object Game Object, per-object Scene, and global Scene) plus standard Game Object events for comprehensive input handling.

Quick Start

Create a simple scene by enabling keyboard and pointer input, making a game object interactive, and handling pointer and drag events.

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, mouse, and touch input in Phaser 4?

A unified input plugin consolidates keyboard, mouse, touch, pointer, and gamepad handling into a single scene-scoped API exposed as `this.input`, simplifying cross-device gameplay logic.

How do I make a sprite draggable and track pointer events in Phaser?

You make objects draggable and track pointer events using built-in pointer management, which supports multiple pointers, custom hit areas, and three levels of events for per-object and global interactions.

Can I capture keyboard keys to prevent browser defaults in Phaser?

Yes, the keyboard module lets you create keys and combos while capturing specific keys to prevent browser defaults, ensuring gameplay inputs do not trigger unintended page actions.

How does the event model work for pointer interactions in Phaser?

The pointer event model operates across three levels: per-object Game Object events, per-object Scene events, and global Scene events, providing comprehensive coverage for interactive UI mechanics.

Does Phaser support gamepad input alongside mouse and touch events?

Yes, the unified input system includes gamepad support alongside mouse and touch events, allowing developers to manage cross-device gameplay inputs within the same scene-scoped API.