Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Covers Phaser 4 geometry classes, intersection tests, and math utilities: vectors, angles, distance, interpolation, random, and snapping.
55% 95%+41 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 12 of 22 without it.
Before generating dynamic textures in a Phaser 4 rendering tool, I need to verify whether the texture dimensions (width and height) are both valid powers of two. Write a snippet using Phaser 4 utilities to perform this check instead of manual bitwise operations.
Uses Phaser.Math.Pow2.IsSizePowerOfTwo to validate dimensions
3 of 3 safety checks passed
Geom classes (Circle, Ellipse, Line, Polygon, Rectangle, Triangle), intersection tests, and Math utilities (Vector2, Vector3, Matrix4, angles, distances, interpolation, easing, random, snap, clamp).
Related skills: graphics-and-shapes.md, physics-arcade.md
// Create geometry objects (these are data only, not renderable)
const rect = new Phaser.Geom.Rectangle(10, 20, 200, 100);
const circle = new Phaser.Geom.Circle(400, 300, 50);
const line = new Phaser.Geom.Line(0, 0, 100, 100);
// Point containment
rect.contains(50, 50); // true
circle.contains(410, 310); // true
// Intersection test
Phaser.Geom.Intersects.CircleToRectangle(circle, rect); // boolean
// Math utilities
const v = new Phaser.Math.Vector2(3, 4);
v.length(); // 5
v.normalize(); // {x: 0.6, y: 0.8}
const dist = Phaser.Math.Distance.Between(0, 0, 100, 100);
const angle = Phaser.Math.Angle.Between(0, 0, 100, 100);
const clamped = Phaser.Math.Clamp(150, 0, 100); // 100
Geometry objects are pure data containers holding coordinates and dimensions. They are NOT game objects and cannot be added to the display list. To render geometry, use the Graphics game object or Shape game objects (see graphics-and-shapes.md).
Every geom class has a type property set to a Phaser.Geom constant for fast type checks.
Next to this one in the catalogue, plus popular skills in the same category.