graphics-and-shapes

Draw Phaser 4 graphics primitives and shape objects for vector visuals.

40.1k|7.2k|Updated Apr 12, 2013
One-click install
npx skills add https://github.com/phaserjs/phaser --skill graphics-and-shapes-phaserjs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: graphics-and-shapes
Source: https://github.com/phaserjs/phaser/tree/main/skills/graphics-and-shapes
Command: npx skills add https://github.com/phaserjs/phaser --skill graphics-and-shapes-phaserjs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Phaser developers need a clear guide to rendering dynamic shapes and visuals without textures, covering Graphics primitives and Shape objects in Phaser 4.

Core Features & Use Cases

  • Draw shapes with Graphics (fillRect, strokeCircle, gradients) and Shape objects (Rectangle, Circle, Polygon, Grid, IsoBox, IsoTriangle, Line, etc.)
  • Generate reusable textures from drawings for UI and gameplay visuals
  • Understand when to use Graphics vs Shape objects for performant and flexible visuals

Quick Start

Create a Graphics object and draw a filled rectangle and a stroked circle to see immediate results.

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 and vector graphics in Phaser 4?

Draw shapes in Phaser 4 using Graphics primitives like fillRect and strokeCircle, or Shape objects like Rectangle, Circle, and Polygon to render vector visuals for real-time game UIs and dynamic gameplay elements.

What is the difference between Graphics and Shape objects in Phaser 4?

Graphics objects use primitive drawing methods like fillRect and strokeCircle, while Shape objects represent individual geometries like Grid, IsoBox, and Line. Choosing between them ensures performant and flexible vector rendering for different gameplay scenarios.

Can I generate reusable textures from Phaser 4 vector graphics?

Yes, you can generate reusable textures from Graphics drawings. This allows you to apply vector visuals to UI components and gameplay elements, optimizing rendering by baking static shapes into textures.

Do I need WebGL to render dynamic shapes and debug overlays in Phaser?

Phaser leverages WebGL for efficient vector rendering of dynamic shapes and debug overlays. Familiarity with Graphics, FillStyle, LineStyle, and Shape classes is required to implement these visual elements effectively.

What types of geometry objects are available for Phaser game development?

Available geometry objects include Rectangle, Circle, Polygon, Grid, IsoBox, IsoTriangle, and Line. These Shape objects provide flexible options for rendering dynamic gameplay elements and debug overlays.