Assuming 2 sprites in a scene, how does one draw a line from one to the other? Here's my attempt, starting from one of the examples in the sandbox:
function create (data)
{
const sprite1 = this.add.sprite(100, 100, 'mech');
const sprite2 = this.add.sprite(400, 400, 'mech');
sprite1.setInteractive();
sprite1.on(
'pointerdown',
() => this.add.line(
0,
0,
sprite1.x,
sprite1.y,
sprite2.x,
sprite2.y,
0xff0000
)
);
}
result after clicking:
Slope and magnitude looks right, but the starting and ending points appear wrong. Can anyone see what I'm doing wrong?
src_scenes_boot data.js