I create a class ------
class Bgm extends Phaser.Sound {
constructor({ game, key, volume, loop }) {
super(game, key, volume, loop);
// this.game.add.existing(this);
}
}
and I new it in a state with ------
this.game.bgm = new Bgm({ game: GAME, key: "bgm", volume: 0.5, loop: true });
instead of ------
this.game.bgm = this.game.add.audio("bgm", 0.5, true);
however, I cannot add it to game just like image or sprite using ------
this.game.add.existing(this); // in my class
how can I add audio using such ES6 style?