Need Help With Getting Mouse Input X, Y & Mouse Left Button

Hi,

I’ve been trying for a couple of hours to get mouse input working.
(X, Y & mouse left button)

I just need to see an example JavaScript code to get the 3 above values.
Thanks in advance…

Jesse Lee

Current stable Phaser 3 demo game is always below with URL to source:

Hi

I have below code now.
Left mouse button clicks work, but unsure about x, y location on screen.

Jesse Lee

function GetInput ()
{
    MouseButtonLeftPressed = false;
    MouseButtoneRightPressed = false;

    if (DelayAllUserInput > 0)
    {
        DelayAllUserInput--;
        return;
    }

    const pointer = this.input.activePointer;
    MouseX = pointer.worldX;
    MouseY = pointer.worldY;

    if (pointer.isDown === true)  MouseButtonLeftPressed = true;
    else if ( pointer.rightButtonDown() === true) MouseButtoneRightPressed = true;
   


}

The official examples are the best place to start.

https://labs.phaser.io/index.html?dir=input/pointer/&q=