groups-and-containers

Group game objects with Phaser.GameObjects.Group, Container, and Layer APIs.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill groups-and-containers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: groups-and-containers
Source: https://github.com/Raphe-dev/phaser-cozy-mmo/tree/main/skills/groups-and-containers
Command: npx skills add https://github.com/Raphe-dev/phaser-cozy-mmo --skill groups-and-containers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Groups, Containers, and Layers help structure your Phaser 4 scenes by grouping logic, applying shared transforms, and controlling render order.

Core Features & Use Cases

  • Logical grouping with Groups for pooling and non-visual collections
  • Visual grouping with Containers to share transforms and nesting
  • Render-order bucketing with Layers for layered UI and scene elements
  • Use Case: Manage enemies as a pooled group, HUD as a container, and world elements in a dedicated layer

Quick Start

Create a group for pooling, a container for combined transforms, and a layer to manage render order.

Frequently Asked Questions about groups-and-containers

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

FAQPage Schema
What is the difference between Groups, Containers, and Layers in Phaser 4?

Groups manage logical collections for object pooling, Containers apply shared visual transforms and nesting, and Layers control render order in Phaser 4. Use Groups for non-visual collections, Containers for combined transforms, and Layers for depth bucketing.

How do I pool game objects in Phaser 4 using Groups?

Pool game objects in Phaser 4 by using Phaser.GameObjects.Group to manage logical collections. Apply common pooling patterns like getFirstDead and add to efficiently recycle inactive game objects during gameplay.

How do I apply shared transforms to multiple game objects in Phaser?

Apply shared transforms to multiple game objects by adding them to a Phaser.GameObjects.Container. Containers support nested transforms, allowing you to move, scale, or rotate the parent container and automatically apply those visual changes to all child objects.

What's the best way to manage render order for UI and world elements in Phaser 4?

Manage render order for UI and world elements by using Phaser.GameObjects.Layer to bucket game objects. Layers handle depth management and layer depth ordering, ensuring HUD and world elements render in the correct sequence across your scenes.

Does this approach support nested transforms and scroll factors for game objects?

Yes, this approach supports nested transforms through Containers and allows you to set scroll factors on grouped game objects. You can apply setScrollFactor and manage depth ordering across gameplay, UI, and batching scenarios in Phaser 4.