The function you’re looking at exists on the Polygon Game Object (Phaser.GameObjects.Polygon
), but you’re working with the geometric shape (Phaser.Geom.Polygon
). The Game Object can be rendered to a scene (just like any other Game Object), while the geometric shape is a logical representation of a polygon.
If you want to use the Game Object, you’ll have to instantiate the correct class (new Phaser.GameObjects.Polygon(scene, coords)
) or use the Game Object Factory (scene.add.polygon
).
If the geometric shape is actually what you want to use, the smoothing method for it is static - Phaser.Geom.Polygon.Smooth
.