Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created November 29, 2021 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shohan4556/dbe88f71bb6dc78c667ab33f9b3a1717 to your computer and use it in GitHub Desktop.
Save shohan4556/dbe88f71bb6dc78c667ab33f9b3a1717 to your computer and use it in GitHub Desktop.
function create ()
{
var polygon = new Phaser.Geom.Polygon([
400, 100,
200, 278,
340, 430,
650, 80
]);
var graphics = this.add.graphics({ x: 0, y: 0 });
graphics.lineStyle(2, 0x00aa00);
graphics.beginPath();
graphics.moveTo(polygon.points[0].x, polygon.points[0].y);
for (var i = 1; i < polygon.points.length; i++)
{
graphics.lineTo(polygon.points[i].x, polygon.points[i].y);
}
graphics.closePath();
graphics.strokePath();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment