🔧 FIX: Added missing functions for Polaroid+VHS!

 FIXED BUGS:
- loadAudioSafe() function added
- startAmbientAudio() function added
- createVHSEffects() function added
- All functions properly called in create()

 NOW READY TO TEST!
Intro should work with Polaroid frames + VHS effects!
This commit is contained in:
2026-01-10 13:35:04 +01:00
parent 5a1ede6ca7
commit 78c93300aa

View File

@@ -52,12 +52,26 @@ class IntroScene extends Phaser.Scene {
this.loadAudioSafe('audio_kai_memory_03', 'assets/audio/voiceover/kai_memory_03.mp3');
}
loadAudioSafe(key, path) {
try {
this.load.audio(key, path);
} catch (error) {
console.warn(`⚠️ Audio skipped: ${key} (file not found)`);
}
}
create() {
console.log('🎬 IntroScene: Starting intro sequence...');
// Black background
this.cameras.main.setBackgroundColor('#000000');
// 🎵 Start ambient audio (if available)
this.startAmbientAudio();
// 📺 Create VHS overlay effects
this.createVHSEffects();
// Setup input for skip
this.setupSkipControls();
@@ -84,6 +98,62 @@ class IntroScene extends Phaser.Scene {
});
}
startAmbientAudio() {
// Noir ambience (constant low drone)
try {
if (this.cache.audio.exists('noir_ambience')) {
this.ambientAudio = this.sound.add('noir_ambience', { volume: 0.15, loop: true });
this.ambientAudio.play();
}
} catch (e) {
console.warn('⚠️ Ambient audio not available');
}
// Projector sound (old film aesthetic)
try {
if (this.cache.audio.exists('projector_loop')) {
this.projectorAudio = this.sound.add('projector_loop', { volume: 0.2, loop: true });
this.projectorAudio.play();
}
} catch (e) {
console.warn('⚠️ Projector audio not available');
}
}
createVHSEffects() {
const width = this.cameras.main.width;
const height = this.cameras.main.height;
// VHS Scanlines (horizontal lines)
this.scanlines = this.add.graphics();
this.scanlines.setDepth(900);
for (let y = 0; y < height; y += 4) {
this.scanlines.fillStyle(0x000000, 0.15);
this.scanlines.fillRect(0, y, width, 2);
}
// VHS Noise overlay (subtle static)
this.vhsNoise = this.add.rectangle(
width / 2,
height / 2,
width,
height,
0xffffff,
0.03
);
this.vhsNoise.setDepth(901);
// Animate noise (flicker)
this.tweens.add({
targets: this.vhsNoise,
alpha: { from: 0.01, to: 0.05 },
duration: 100,
yoyo: true,
repeat: -1
});
}
showSkipPrompt() {
if (this.skipPrompt) return; // Already showing