Things I want to do
We’ll use Phaser3 to consolidate mouse events for GameObjects.
How to participate in an event
First, allow mouse interaction with the game object.
GameObject.setInteractive();The following options are required when dragging:
GameObject.setInteractive({ draggable: true });The following processing is linked during the event:
GameObject.on(イベント名, function));example:
const rect = this.add.rectangle(400, 300, 100, 100, 0xff0000);
rect.setInteractive();
rect.on('pointerdown', () => alert("clicked")); //追加Event List
Websites I used as references
Redirecting to https://docs.phaser.io


コメント