Line Between

Demonstrates how to draw a straight line between two points with a custom thickness and color using the Graphics object.

Line Between, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    create ()
    {
        const graphics = this.add.graphics();
        graphics.lineStyle(128, 0x00ff00, 1);
        graphics.lineBetween(100, 100, 600, 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);

More in Primitives17 examples