How can i get mouseX mouseY in Phaser3?

in phaser2,i can get it with game.input.x & game.input.y.
but in Phaser3?
Please Help me~thx…

1 Like
var pointer = scene.input.activePointer;
var x = pointer.x;
var y = pointer.y;
var worldX = pointer.worldX;
var worldY = pointer.worldY;
2 Likes

Thank you very much~
The props is removed in game.input…

You shouldn’t use game.input in v3. In fact, you shouldn’t use game.anything in v3, everything is handled via Scene plugins.

2 Likes

Thx~

When I try to use the code

this.scene.input.activePointer;

I get the error, “Property ‘input’ does not exist on type ‘ScenePlugin’.”

What kind of scene plugin do I need to add, and how exactly do I add it? :thinking:

That’s telling you this.scene has no input property.

You’re looking for this.input.

2 Likes

DERP!

@samme thx buddy :+1:

@rich but what if we want to control something that is throughout the game, like audio across different scenes? Is it advisable to use game.sound.mute?