diff --git a/src/scenes/StoryScene.js b/src/scenes/StoryScene.js index 5247ebca9..16a6bf76e 100644 --- a/src/scenes/StoryScene.js +++ b/src/scenes/StoryScene.js @@ -144,15 +144,32 @@ class StoryScene extends Phaser.Scene { playNoirMusic() { // Play forest evening ambience (noir atmosphere) - if (this.sound.get('forest_ambient')) { - const music = this.sound.add('forest_ambient', { - volume: 0.3, - loop: true - }); - music.play(); - console.log('🎵 Noir atmosphere music playing at 30% volume'); - } else { - console.warn('⚠️ forest_ambient music not loaded - add to preload()'); + try { + if (this.sound.get('forest_ambient')) { + const music = this.sound.add('forest_ambient', { + volume: 0.3, + loop: true + }); + music.play(); + console.log('🎵 Noir atmosphere music playing at 30% volume'); + } else { + console.warn('⚠️ forest_ambient not loaded yet - trying alternative'); + // Try to load and play immediately + this.load.audio('forest_ambient', 'assets/audio/music/forest_ambient.mp3'); + this.load.once('complete', () => { + try { + const music = this.sound.add('forest_ambient', { volume: 0.3, loop: true }); + music.play(); + console.log('🎵 Loaded and playing forest_ambient'); + } catch (e) { + console.error('❌ Failed to play music:', e.message); + } + }); + this.load.start(); + } + } catch (error) { + console.error('❌ Audio error (non-critical):', error.message); + console.log('✅ Game continues without music'); } }