groups-and-containers

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

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

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 pooling, or render-order bugs. This Skill provides decision guidance, correct API usage, and gotcha warnings for all three structures. ## Core Features & Use Cases - Structure Selection Guidance: Compares Group, Container, and Layer across transforms, display list behavior, physics, input, and pooling so you pick the right one. - Object Pooling Patterns: Covers getFirstDead, killAndHide, maxSize, and pool capacity queries for bullets, enemies, and particles. - Nested Transforms & Render Ordering: Shows Container hierarchies with inherited position, scale, and alpha, plus Layer-based depth control. - Use Case: Build a bullet system with a pooled physics Group, a HUD pinned to the camera inside a Container, and background/foreground Layers for render order. ## Quick Start Ask the AI to create a Phaser 4 scene with a pooled bullet Group, a Container-based HUD, and separate background and foreground Layers.

Frequently Asked Questions about groups-and-containers

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

FAQPage Schema
How do I implement object pooling in Phaser 4?

Create a Group with a maxSize and classType, then use group.get(x, y) or getFirstDead to reuse inactive members instead of creating new ones. Deactivate objects with killAndHide, which sets active and visible to false while keeping them in the pool 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 object whose position, rotation, scale, and alpha are inherited by its children, making it suited for composite UI elements and moving clusters.

Does Phaser Container support physics bodies on children?

Physics bodies on Container children are problematic because bodies become offset when the Container is not at position (0,0). The recommended approach is to use physics groups via this.physics.add.group() instead of placing physics objects inside Containers.

Why is my Phaser Container not responding to input events?

Containers have no implicit size, so setInteractive fails without a defined hit area. Call container.setSize(width, height) before setInteractive() to establish the hit area that input events require.

When should I use a Layer instead of a Group in Phaser?

Use a Layer when you need render-order control and shared alpha, blend mode, or mask across objects without transforms. Layers are lightweight render buckets, but they cannot be nested inside Containers and have no position, scale, or rotation.