scale-and-responsive

Configures Phaser 4 ScaleManager for responsive scaling, centering, fullscreen, and orientation handling.

465|41|Updated Aug 4, 2026
One-click install
npx skills add https://github.com/autonomous-ai/openharness --skill scale-and-responsive-autonomous-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scale-and-responsive
Source: https://github.com/autonomous-ai/openharness/tree/main/store/agents/phaser/skills/scale-and-responsive
Command: npx skills add https://github.com/autonomous-ai/openharness --skill scale-and-responsive-autonomous-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser games often break visually when the browser window resizes, the device rotates, or the canvas must fit different screen sizes. This Skill provides the exact ScaleManager configuration patterns, scale modes, and event handling needed to make a Phaser 4 game responsive across desktop and mobile displays. ## Core Features & Use Cases - Scale Mode Configuration: Apply FIT, RESIZE, ENVELOP, EXPAND, and other scale modes with auto-centering, zoom, snap values, and min/max constraints through the game config. - Runtime Resize and Fullscreen Handling: Respond to resize and orientation events, toggle fullscreen from pointer gestures, and lock orientation on mobile devices. - Use Case: You are building a pixel-art game at 320x240 that must fill any browser window crisply. Use FIT mode with MAX_ZOOM and pixelArt enabled, then listen to the resize event to reposition UI elements when the window changes. ## Quick Start Ask the agent to make my Phaser game responsive using FIT scale mode with auto-centering and a resize event handler in my scene.

Frequently Asked Questions about scale-and-responsive

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

FAQPage Schema
How do I make a Phaser game responsive to window resizing?

Set the scale mode to Phaser.Scale.RESIZE with width and height as '100%' in the game config, then listen to the scale 'resize' event in your scene. In the handler, resize cameras and reposition UI elements based on the new gameSize dimensions.

What is the difference between FIT and RESIZE scale modes in Phaser?

FIT scales the canvas via CSS to fit inside the parent while preserving aspect ratio, leaving letterbox bars. RESIZE changes the actual canvas dimensions to match the parent with 1:1 pixel mapping, which can increase GPU fill-rate load on large displays.

How do I center a Phaser game canvas on the page?

Set autoCenter to Phaser.Scale.CENTER_BOTH in the scale config. The parent element must have calculable CSS dimensions, since centering applies marginLeft and marginTop based on the parent's computed bounds.

Why does Phaser fullscreen not work on mobile touch devices?

Fullscreen requests from pointerdown are blocked on touch devices unless the document already received touch input. Always call startFullscreen or toggleFullscreen from a pointerup handler, and add the allowfullscreen attribute when running inside an iframe.

How do I handle device orientation changes in a Phaser game?

Subscribe to the scale 'orientationchange' event, which delivers an orientation string like 'landscape-primary'. You can check game.scale.isPortrait or isLandscape and call lockOrientation('landscape') on mobile browsers that support it.

When should I use resize() versus setGameSize() in Phaser?

Use resize() only in NONE scale mode, where it directly sets game, base, and display sizes. Use setGameSize() with scaled modes like FIT or ENVELOP so the ScaleManager re-applies the scaling calculations after changing the base game size.