Stroked Triangle
Demonstrates how to draw outlined triangles using different line styles, widths, and colors with the Graphics object.
800 × 600
class Example extends Phaser.Scene
{
create ()
{
const graphics = this.add.graphics();
graphics.lineStyle(1, 0xffffff, 1);
graphics.strokeTriangle(200, 200, 400, 50, 500, 300);
graphics.lineStyle(4, 0x00ffff, 1);
graphics.strokeTriangle(60, 500, 60, 400, 500, 500);
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
width: 800,
height: 600,
type: Phaser.WEBGL,
parent: 'game-container',
scene: Example
};
const game = new Phaser.Game(config);