The purpose
Summarizing mouse events for GameObjects in Phaser 3.
How to receive event
First, enable mouse interaction for the game object.
GameObject.setInteractive();
If you are going to use drugs, the following options are required.
GameObject.setInteractive({ draggable: true });
Event handling will be linked as follows.
GameObject.on(event name, function));
Example:
const rect = this.add.rectangle(400, 300, 100, 100, 0xff0000);
rect.setInteractive();
rect.on('pointerdown', () => alert("clicked")); //add
Event list
Reference
Events - Phaser 3 API Documentation
comment