groups-and-containers

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

Updated Sep 20, 2026
One-click install
npx skills add https://github.com/AmirOssanloo/helix-game --skill groups-and-containers-amirossanloo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: groups-and-containers
Source: https://github.com/AmirOssanloo/helix-game/tree/main/.claude/skills/groups-and-containers
Command: npx skills add https://github.com/AmirOssanloo/helix-game --skill groups-and-containers-amirossanloo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Phaser 4 developers often struggle to choose between Groups, Containers, and Layers when organizing game objects, and frequently misuse them—causing broken transforms, failed pooling, or physics offsets. This Skill provides decision guidance, correct API usage, and gotchas for each structure. ## Core Features & Use Cases - Structure Selection: 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 reusing bullets, enemies, and particles without destroying them. - Nested Transforms & Render Ordering: Shows Container hierarchies for composite UI and Layer-based depth control for scene rendering. - Use Case: Building a bullet system for a shooter—use a physics Group with maxSize 30, fire with group.get(), and recycle with killAndHide instead of creating and destroying sprites every shot. ## Quick Start Ask the AI to create a pooled bullet system in Phaser 4 using a Group with getFirstDead and killAndHide.

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 call group.get(x, y) to fetch the first inactive member or create one. Recycle objects with killAndHide, which sets active and visible to false without removing them from the group.

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

A Group is a logical collection with no transform, ideal for pooling and physics. A Container is a display-list GameObject whose position, rotation, scale, and alpha are inherited by children, making it suited for composite UI but with per-frame matrix overhead.

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

Use a Layer when you only need render-order bucketing and shared alpha, blend mode, or mask without position, rotation, or scale. Layers are lightweight, but they cannot be nested inside Containers.

Why are physics bodies offset when children are inside a Container?▼

Physics bodies on Container children become offset when the Container is not positioned at (0,0), because body coordinates do not account for the parent's transform. Avoid attaching physics bodies to Container children; use physics Groups instead.

Why does setInteractive not work on a Phaser Container?▼

Containers have no implicit size, so input fails until you call container.setSize(width, height) to define a hit area before setInteractive. Without an explicit size, pointer events have no region to test against.

Does killAndHide remove an object from a Phaser Group?▼

No, killAndHide only sets active=false and visible=false; the object remains in the Group for reuse. This is the intended pooling behavior, letting group.get() return the inactive member later.