Hi,
I was wondering if there is a better way to detect two pointer events than my current code. For example in this code, i’m trying to draw a line from point A to point B by detecting point A when the user touched down and point B while the user still pressed own and moving.
However i’m having an issue with my code, After the first pointer down event, it will keep drawing lines even after releasing the pointer. How can I make sure it only draws when pointer is down and moving ?
function create() {
this.input.on('pointerdown', (pointer) => {
startLineXpos = pointer.x;
startLineYpos = pointer.y;
this.input.on('pointermove', (pointer, currentlyOver) => {
this.add.line(0, 0, startLineXpos, startLineYpos, pointer.x, pointer.y, 0xff6699), console.log("pointermove: X " + pointer.x + " Y " + pointer.y);
})
});}
Thanks