Skip to content
phaserjs avatar

Input Keyboard Mouse Touch

Keyboard, mouse, touch, and gamepad input for Phaser 4 Scenes via the this.input plugin.

CCM score
74 of 100
skills.sh installs
1.3K
GitHub stars
40.8K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers keyboard polling and events, pointer clicks and movement, multi-touch, mouse wheel, drag and drop, and gamepad input
  • Includes hit areas for circle, ellipse, rectangle, triangle, and polygon shapes, plus pixel-perfect hit testing
  • Provides Pointer properties for position, button state, velocity, and drag distance, and interactive Game Object setup via setInteractive
  • Designed for Phaser 4 projects that handle player input through event listeners or per-frame state polling

Install

$ npx -y skills add phaserjs/phaser --skill input-keyboard-mouse-touch -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Input: Keyboard, Mouse, Touch, and Gamepad

Phaser provides a unified input system accessed via this.input in 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();

Details

Repository
github.com/phaserjs/phaser
Categories
Game Development, Frontend & UI Code
First seen
Jun 3, 2026

Questions

What does the input-keyboard-mouse-touch skill do for Phaser games?

It guides handling of user input in Phaser 4, covering keyboard keys, mouse clicks and movement, touch events, pointers, drag and drop, hit areas, interactive objects and gamepad support. It also explains polling input state each frame or using event listeners through this.input in any Scene.

How do I make a sprite clickable in Phaser with this skill?

Call sprite.setInteractive() to enable input on a Game Object, which uses the texture frame as the hit area by default. You can then listen for sprite.on('pointerdown') to react to clicks, and pass a custom shape or pixel-perfect option for finer hit testing.

How do I install the input-keyboard-mouse-touch skill?

Run npx -y skills add phaserjs/phaser --skill input-keyboard-mouse-touch -y in your project. After that, the agent can write Phaser code for keyboard, mouse, touch and gamepad input.

Where does this skill stand in the Game Development category?

It sits in the Game Development category alongside skills such as game-feel, game-ui-ux and level-design. It focuses specifically on the input side of Phaser 4 games rather than on feel, interface or level structure.

More from phaserjs/phaser

All 8

Similar to Input Keyboard Mouse Touch

More Game Development