groups-and-containers

Organizes Phaser 4 game objects using Groups, Containers, and Layers with pooling and transforms.

Updated Jul 13, 2026
One-click install
npx skills add https://github.com/russellmorgan/UnderConstruction --skill groups-and-containers-russellmorgan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: groups-and-containers
Source: https://github.com/russellmorgan/UnderConstruction/tree/main/.claude/skills/groups-and-containers
Command: npx skills add https://github.com/russellmorgan/UnderConstruction --skill groups-and-containers-russellmorgan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser 4 developers often struggle to choose between Groups, Containers, and Layers when organizing game objects, leading to broken transforms, failed object pooling, or misplaced render ordering. ## Core Features & Use Cases - Group vs Container vs Layer guidance: A comparison table and decision rules clarify which structure fits logical collections, visual transform inheritance, or render-order bucketing. - Object pooling patterns: Covers getFirstDead, killAndHide, maxSize, and pool capacity queries for reusing bullets, enemies, and particles without destroying them. - Nested transforms and batch operations: Shows Container nesting, scroll factor propagation, and Group bulk methods like setXY stepping, incXY, and propertyValueSet. - Use Case: When building a bullet system, use a Group with maxSize and get() to pool projectiles, then place the HUD in a Container with setScrollFactor(0) so it stays pinned to the camera. ## Quick Start Ask the AI to show how to create an object pool of bullets with a Phaser 4 Group and a camera-pinned HUD Container.

Frequently Asked Questions about groups-and-containers

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

FAQPage Schema
How do I create an object pool in Phaser 4?▼

Create a Group with a maxSize and classType, then call group.get(x, y) to retrieve the first inactive member or create a new one. Deactivate objects with killAndHide() instead of destroying them so they stay available for reuse.

What is the difference between Group and Container in Phaser?▼

A Group is a logical collection with no position or transform, ideal for pooling and physics. A Container is a display-list GameObject whose position, rotation, scale, and alpha are inherited by its children, suited for composite UI elements.

When should I use a Layer instead of a Container in Phaser 4?▼

Use a Layer when you only need render-order control and shared alpha, blend mode, or mask across a batch of objects. Layers have no position, rotation, or scale, making them lighter than Containers for pure depth bucketing.

Why is my Phaser Container input not working?▼

Containers have no implicit size, so setInteractive() fails without a hit area. Call container.setSize(width, height) before setInteractive() to define the clickable region.

Can I use physics bodies on children inside a Phaser Container?▼

Physics bodies on Container children are problematic because bodies become offset when the Container is not at (0,0). Use physics groups via this.physics.add.group() instead, which assign bodies to members directly on the Scene.

Why does moving a Phaser Group not move its children?▼

A Group is not on the display list and has no transform, so setting its position does nothing visually. Its children render individually on the Scene; use a Container if you need children to move as a unit.