audio-and-sound
Installation
SKILL.md
Phaser Audio und Sound
Verwandte Skills: ../loading-assets/SKILL.md, ../events-system/SKILL.md
Phasers Sound Manager ist global. Sounds stoppen beim Szenenwechsel nicht automatisch und Browser verlangen oft eine Nutzerinteraktion vor der ersten Wiedergabe.
Schnellstart
this.load.audio("hit", ["audio/hit.mp3", "audio/hit.ogg"]);
this.sound.play("hit", { volume: 0.45 });
const music = this.sound.add("music", { loop: true, volume: 0.6 });
music.play();
this.events.once(Phaser.Scenes.Events.SHUTDOWN, () => music.stop());