graphics-and-shapes

Draw shapes and graphics primitives in Phaser 4 using Graphics and Shape game objects.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Drawing primitives in Phaser 4 involves two different APIs — the imperative Graphics object and standalone Shape game objects — with subtle differences in components, angle units, and styling that cause frequent bugs. This Skill provides the correct patterns, method signatures, and gotchas so you draw rectangles, circles, arcs, polygons, and gradients correctly the first time. ## Core Features & Use Cases - Graphics Drawing: Covers fillStyle, lineStyle, gradients, paths, arcs, rounded rectangles, canvas transforms, and generateTexture for baking drawings into reusable textures. - Shape Game Objects: Documents all 12 shape factories (arc, circle, curve, ellipse, grid, isobox, isotriangle, line, polygon, rectangle, star, triangle) with parameters, fill/stroke styling, and shape-specific methods. - Gotcha Prevention: Flags the most common errors, such as Graphics arc() using radians while the arc factory uses degrees, and Shape objects lacking setTint(). - Use Case: You need a health bar, a star icon, and a checkerboard grid in your Phaser 4 game. This Skill gives you the exact factory calls, styling methods, and performance guidance (generateTexture for static shapes) to implement them. ## Quick Start Use the graphics-and-shapes skill to draw a filled rounded rectangle with a stroked circle in my Phaser 4 scene.

Frequently Asked Questions about graphics-and-shapes

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

FAQPage Schema
How do I draw shapes in Phaser 4?▼

Use this.add.graphics() for imperative drawing with methods like fillRect, strokeCircle, and fillRoundedRect, or use Shape factories like this.add.rectangle() and this.add.circle() for individual game objects. Set fillStyle or lineStyle before calling the corresponding draw method.

Phaser Graphics vs Shape objects: which should I use?▼

Use Graphics for dynamic drawing, complex paths, gradients, multiple shapes on one object, or generating textures. Use Shape objects for individual UI elements or physics-enabled shapes, since they include Origin and GetBounds components and support input, tweens, and containers.

How do I generate a texture from Phaser Graphics?▼

Draw your shapes on a Graphics object, then call generateTexture(key, width, height) to bake it into a texture usable by Images and Sprites. Note that fillGradientStyle will not appear in generated textures due to a Canvas API limitation.

Why is my Phaser arc drawing at the wrong angle?▼

The Graphics arc() method takes start and end angles in radians, while the this.add.arc() factory takes them in degrees (0-360). Mixing these units is the most common arc bug — check which API you are calling.

Can I tint a Shape object in Phaser 4?▼

No, Shape game objects do not support setTint() or tint properties like Sprites and Images do. Change their appearance with setFillStyle(color, alpha) and setStrokeStyle(lineWidth, color, alpha) instead.

Why is my Phaser Graphics rendering slowly?▼

Graphics replays its command buffer and rebuilds geometry every frame, which is expensive for complex shapes. For static drawings, call generateTexture and use the result as a Sprite, and group Graphics objects together to minimize batch flushes.