Created
November 29, 2021 11:20
-
-
Save shohan4556/dbe88f71bb6dc78c667ab33f9b3a1717 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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