Skip to content

feat: Add regular polygon constructors to PolygonComponent and PolygonHitbox#3891

Open
TRI99ERED wants to merge 3 commits intoflame-engine:mainfrom
TRI99ERED:feat/regular-polygon-constructors
Open

feat: Add regular polygon constructors to PolygonComponent and PolygonHitbox#3891
TRI99ERED wants to merge 3 commits intoflame-engine:mainfrom
TRI99ERED:feat/regular-polygon-constructors

Conversation

@TRI99ERED
Copy link
Copy Markdown

Summary

Adds PolygonComponent.regularPolygon and PolygonHitbox.regularPolygon constructors to easily create regular (equiangular and equilateral) polygons by specifying the number of sides and radius.

Usage

`dart
// Create a regular hexagon
PolygonComponent.regularPolygon(6, radius: 100);

// Create a regular octagon hitbox
PolygonHitbox.regularPolygon(8, radius: 50, isSolid: true);
`

Closes #3890

@TRI99ERED TRI99ERED changed the title feat: add regular polygon constructors to PolygonComponent and PolygonHitbox feat: Add regular polygon constructors to PolygonComponent and PolygonHitbox Apr 6, 2026
Copy link
Copy Markdown
Member

@ufrshubham ufrshubham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TRI99ERED please follow the original PR description template. Also, add some tests for this change.

Comment thread packages/flame/lib/src/geometry/polygon_component.dart Outdated
@spydon
Copy link
Copy Markdown
Member

spydon commented Apr 19, 2026

@TRI99ERED will you update this PR? :)

@TRI99ERED
Copy link
Copy Markdown
Author

Sorry for the delay, some stuff came up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add regular constructors to PolygonComponent and PolygonHitbox

3 participants