I know how to start background music, but how do you change it upon a key press?
this.music = this.sound.add("music");
this.music2 = this.sound.add("music2");
let musicConfigur = {
mute: false,
volume: 1,
rate: 1,
detune: 0,
seek: 0,
loop: true,
delay: 0
}
That was the music Configuration which was in the create function.
this.music.play(musicConfigur);
This plays the music. Below is a key that when pressed should change the music with the same configuration. I already added the keybinds using keycodes
if(this.key_m.isDown){
this.music2.play(musicConfigur);
}
Thank you for your help!