ゲームオブジェクトのタッチイベント
ここでのゲームオブジェクトとは、Phaser.GameObjects.SpriteやPhaser.GameObjects.Rectangleなどのことを指します。例ではPhaser.GameObjects.Spriteを使用します。
const sprite = this.add.sprite(x, y, 'key');
タッチイベントの有効化
sprite.setInteractive(); // タッチイベントを有効化
タッチイベントの追加
sprite.on('pointerdown', () => {
// タッチ時の処理
});
sprite.on('pointerup', () => {
// タッチ終了時の処理
});
sprite.on('pointermove', () => {
// タッチ移動時の処理
});