Hi all!
Trying to do something where I change the volume of an audio instance after it has been created, and Phaser 3 notes says to just use the setVolume
and volume
properties on the BaseSound
class. However, these are not properties in the documentation and are flagging Typescript errors. With an @ts-ignore, this code works.
// class property
backgroundMusicTrack : Phaser.Sound.BaseSound
// in create
create(){
this.backgroundMusicTrack = this.add.sound('key', config);
this.input.on('pointerdown', () => {
this.backgroundMusicTrack.setVolume(this.backgroundMusicTrack.volume-.1);
})
}
Questions :
- Am I using the BaseSound class incorrectly?
- Is there a different class to use to type
backgroundMusicTrack
other than BaseSound?
Thanks all