Create a Line Geometry
How to define a line geometry object using start and end coordinates and render it to the screen using a Graphics object.
800 × 600
class Example extends Phaser.Scene
{
create ()
{
const line = new Phaser.Geom.Line(100, 500, 700, 100);
const graphics = this.add.graphics({ lineStyle: { width: 4, color: 0xaa00aa } });
graphics.strokeLineShape(line);
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
width: 800,
height: 600,
type: Phaser.AUTO,
parent: 'game-container',
scene: Example
};
const game = new Phaser.Game(config);