Phaser home
Phaser AE
Open source
Phaser 4
Download
Learn
Editor
Tools
Docs
Examples
News
Log in
Examples
/
Geom
/
Polygon
Phaser 4.1.0
Phaser 4 examples
Polygon
11
examples
Examples
11
Basic Polygon
How to create a Polygon geometry object from an array of coordinates and render it using Graphics.
Clone a Polygon
Demonstrates how to create independent copies of a Polygon object using the Clone method, allowing multiple instances to be updated and rendered separately.
Complex Polygon
How to define a complex shape using the Phaser Polygon geometry object and render it manually with a Graphics object.
Get Polygon Points
Sample a specific number of coordinates along the edges of a Polygon geometry object.
Polygon Area
Demonstrates how to calculate the area of a polygon dynamically. You can add new points with a click and move the final point with the pointer to see the area update in real-time.
Polygon Contains
Demonstrates how to check if a specific point is located within the boundaries of a Polygon geometry object.
Polygon Contains Point
Check if a specific point, such as the mouse cursor, is located within the bounds of a Polygon geometry object.
Polygon Edge Rays
Demonstrates casting rays from a point to the vertices of multiple polygons using the GetRaysFromPointToPolygon intersection utility.
Polygon Get AABB
Calculate and visualize the Axis-Aligned Bounding Box (AABB) of a polygon as its points are modified dynamically.
Polygon Get Number Array
Demonstrates how to extract a flat array of coordinate numbers from a Polygon geometry object.
Set Polygon Points Dynamically
Demonstrates how to update a Polygon's shape over time by using the setTo method with a growing array of coordinates.