actions-and-utilities

Applies batch operations, grid layouts, and utility functions to Phaser 4 game objects.

Updated May 7, 2021
One-click install
npx skills add https://github.com/travispwingo/travispwingo.github.io --skill actions-and-utilities-travispwingo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: actions-and-utilities
Source: https://github.com/travispwingo/travispwingo.github.io/tree/main/mario/docs/skills/actions-and-utilities
Command: npx skills add https://github.com/travispwingo/travispwingo.github.io --skill actions-and-utilities-travispwingo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Positioning, transforming, and managing large groups of game objects one-by-one in Phaser 4 is repetitive and error-prone. This Skill provides the complete Phaser.Actions namespace plus Array, Object, and String utilities so you can perform batch operations on entire arrays of game objects in a single call. ## Core Features & Use Cases - Batch Property Operations: Set, increment, spread, or interpolate properties like x, y, alpha, scale, and rotation across arrays of game objects with optional per-item step values. - Geometry-Based Placement: Arrange objects on circles, ellipses, lines, rectangles, and triangles, or scatter them randomly within geometric bounds, plus grid alignment via GridAlign. - Utility Namespaces: Use Phaser.Utils.Array for sorting, shuffling, and range generation, Phaser.Utils.Objects for dot-path config lookups, and Phaser.Utils.String for formatting and UUIDs. - Use Case: Spawn 20 enemy sprites, arrange them in a 5x4 grid with GridAlign, fade their alpha from 0 to 1 with Spread, then wrap them inside screen bounds with WrapInRectangle during gameplay. ## Quick Start Ask the AI to create a group of sprites in Phaser 4 and arrange them in a grid layout with staggered alpha values using Phaser.Actions.

Frequently Asked Questions about actions-and-utilities

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

FAQPage Schema
How do I arrange sprites in a grid in Phaser 4?▼

Use Phaser.Actions.GridAlign with a config object specifying width, height, cellWidth, cellHeight, and x/y origin. Pass an array of game objects or group.getChildren() as the first argument, and all items are positioned into the grid in one call.

How to apply the same property change to multiple game objects in Phaser?▼

Use Phaser.Actions setters like SetX, SetAlpha, or SetScale, which take an array of game objects and apply the value to each. The optional step parameter adds an incremental offset per item, and the actions return the same array for chaining.

Can Phaser.Actions work directly on Groups?▼

Phaser.Actions operate on plain arrays, not Group objects directly. Call group.getChildren() to obtain the array of children, then pass it to any action such as GridAlign, Spread, or PlaceOnCircle.

Why does PlaceOnCircle not work with a Phaser GameObjects Circle?▼

Placement actions like PlaceOnCircle and RandomRectangle require Phaser.Geom objects, not Game Object shapes. If you have a Phaser.GameObjects.Circle, pass its .geom property instead of the game object itself.

What is the difference between GetValue and GetFastValue in Phaser?▼

GetValue supports dot-path lookups like 'render.screen.width' with fallback defaults, while GetFastValue only checks top-level keys without dot-path parsing. Use GetFastValue in hot loops where keys are always top-level for better performance.

Does Phaser.Actions Spread work with a single item?▼

Yes, but with one item Spread places it at the midpoint (min + max) / 2 rather than at min. This is expected behavior since interpolation across a single element resolves to the center of the range.