diff --git a/assets/music/slots/gold-rush-gulch.mp3 b/assets/music/slots/gold-rush-gulch.mp3 new file mode 100644 index 0000000..12ee9a5 Binary files /dev/null and b/assets/music/slots/gold-rush-gulch.mp3 differ diff --git a/assets/speech/slots/gold-rush-gulch-bandit.mp3 b/assets/speech/slots/gold-rush-gulch-bandit.mp3 new file mode 100644 index 0000000..ef73c9b Binary files /dev/null and b/assets/speech/slots/gold-rush-gulch-bandit.mp3 differ diff --git a/assets/speech/slots/gold-rush-gulch-intro.mp3 b/assets/speech/slots/gold-rush-gulch-intro.mp3 new file mode 100644 index 0000000..44e1a23 Binary files /dev/null and b/assets/speech/slots/gold-rush-gulch-intro.mp3 differ diff --git a/assets/speech/slots/gold-rush-one-dynomite.mp3 b/assets/speech/slots/gold-rush-one-dynomite.mp3 new file mode 100644 index 0000000..6924d84 Binary files /dev/null and b/assets/speech/slots/gold-rush-one-dynomite.mp3 differ diff --git a/assets/speech/slots/gold-rush-triple-dynomite.mp3 b/assets/speech/slots/gold-rush-triple-dynomite.mp3 new file mode 100644 index 0000000..95ef66f Binary files /dev/null and b/assets/speech/slots/gold-rush-triple-dynomite.mp3 differ diff --git a/assets/speech/slots/gold-rush-two-dynomites.mp3 b/assets/speech/slots/gold-rush-two-dynomites.mp3 new file mode 100644 index 0000000..3d0d77c Binary files /dev/null and b/assets/speech/slots/gold-rush-two-dynomites.mp3 differ diff --git a/src/games/slots/SlotsGame.js b/src/games/slots/SlotsGame.js index a2ece1c..429ecf7 100644 --- a/src/games/slots/SlotsGame.js +++ b/src/games/slots/SlotsGame.js @@ -98,8 +98,14 @@ export default class SlotsGame extends Phaser.Scene { startMusic() { if (this.musicPlayer) return; try { + const m = this.view === 'machine' ? MACHINE_BY_ID[this.machineId] : null; + // Per-machine theme (m.audio.music, relative to assets/music/) replaces + // the shared soundtrack pool while that machine is open. const music = this.cache.json.get('music'); - if (music?.tracks) this.musicPlayer = new MusicPlayer(this, music.tracks); + const tracks = m?.audio?.music + ? [{ file: m.audio.music, artist: m.name, title: 'Theme' }] + : (music?.tracks ?? []); + if (tracks.length) this.musicPlayer = new MusicPlayer(this, tracks); } catch (_) { /* optional */ } } @@ -367,6 +373,8 @@ export default class SlotsGame extends Phaser.Scene { buildMachine() { const m = MACHINE_BY_ID[this.machineId]; this.machine = m; + // One-shot intro cue (per-machine `audio.intro`) as the view opens. + if (m.audio?.intro) this.cueAudio(m.audio.intro); bakeMachineSymbols(this, m); this.session = createSession(m, Math.random); this.bet = m.betLevels[this.betIdx] ?? m.betLevels[0]; @@ -814,6 +822,10 @@ export default class SlotsGame extends Phaser.Scene { }); this.stage?.reelsLanded(result.totalWin > 0); + // Machine audio cues — decided only once every reel has stopped, then + // played sequentially (bandit discovery first, then the dynamite tier). + await this.playSpinCues(result, m); + let spinTotal = result.totalWin; // Animate the engine's step script in order. @@ -948,6 +960,36 @@ export default class SlotsGame extends Phaser.Scene { this.setControlsEnabled(true); } + // ── Per-machine audio cues (the `audio` block in machines.js) ────────────── + // Queues clip files so multiple cues play back-to-back, never overlapping. + cueAudio(file) { + if (!file) return Promise.resolve(); + const run = () => new Promise((resolve) => { + const a = new Audio(file); + a.volume = 1; + a.onended = () => resolve(); + a.onerror = () => resolve(); + a.play().catch(() => resolve()); + }); + const p = (this._cueTail ?? Promise.resolve()).then(run); + this._cueTail = p.catch(() => { /* keep the chain alive */ }); + return p; + } + + // Called after all reels have stopped; collects this spin's cues in order + // and plays them sequentially. Bandit: at least one NEW sticky wild landed. + // Dynamite: tiered by sticks on the reels (1 / 2 / 3+ → highest tier). + async playSpinCues(result, m) { + const a = m.audio ?? {}; + const cues = []; + const stickyStep = result.steps.find((st) => st.type === 'stickyWilds'); + if (a.bandit && stickyStep?.placed?.length > 0) cues.push(a.bandit); + const scatter = m.scatter?.symbol; + const n = scatter ? result.grid.flat().filter((s) => s === scatter).length : 0; + if (a.dynamite?.length && n > 0) cues.push(a.dynamite[Math.min(n, a.dynamite.length) - 1]); + for (const file of cues) await this.cueAudio(file); + } + playStickySteps(step) { for (const { c, r } of step.placed) { const p = this.reelView.cellCenter(c, r); diff --git a/src/games/slots/SlotsGoldRush.js b/src/games/slots/SlotsGoldRush.js index fab5470..775f475 100644 --- a/src/games/slots/SlotsGoldRush.js +++ b/src/games/slots/SlotsGoldRush.js @@ -606,7 +606,8 @@ export class GoldRushProps { if (placed.size > 0) { this.stampPoster(); this.stage.lights.flashAll(0xffe27a, 1); - this.stage.sound('sticky', () => playSound(this.scene, SFX.SCIFI_RISER)); + // The scene plays the machine-specific bandit cue (m.audio.bandit) instead. + if (!this.scene.machine?.audio?.bandit) this.stage.sound('sticky', () => playSound(this.scene, SFX.SCIFI_RISER)); } } diff --git a/src/games/slots/machines.js b/src/games/slots/machines.js index 4c00bea..b08d62d 100644 --- a/src/games/slots/machines.js +++ b/src/games/slots/machines.js @@ -71,6 +71,7 @@ export const MACHINES = [ name: 'Liberty Belle', tagline: '1899 Original', era: 'vintage', + audio: { music: null, intro: null }, featureLabel: 'PULL THE LEVER', layout: { reels: 3, rows: 1 }, evaluation: 'lines', @@ -147,6 +148,7 @@ export const MACHINES = [ name: 'Fruit Frenzy', tagline: '1965 Electro-Mechanical', era: 'vintage', + audio: { music: null, intro: null }, featureLabel: 'HOLD & NUDGE', layout: { reels: 3, rows: 3 }, evaluation: 'lines', @@ -234,6 +236,7 @@ export const MACHINES = [ name: 'Lucky Sevens', tagline: '1975 Vegas Strip', era: 'vintage', + audio: { music: null, intro: null }, featureLabel: 'WILDS DOUBLE PAYS', layout: { reels: 3, rows: 1 }, evaluation: 'lines', @@ -331,6 +334,7 @@ export const MACHINES = [ name: "Pharaoh's Fortune", tagline: 'Free Spins of the Nile', era: 'modern', + audio: { music: null, intro: null }, featureLabel: 'FREE SPINS', layout: { reels: 5, rows: 3 }, evaluation: 'lines', @@ -425,6 +429,7 @@ export const MACHINES = [ name: 'Abyssal Treasures', tagline: 'Cascades of the Deep', era: 'modern', + audio: { music: null, intro: null }, featureLabel: 'CASCADING REELS', layout: { reels: 5, rows: 3 }, evaluation: 'lines', @@ -504,6 +509,7 @@ export const MACHINES = [ name: "Dragon's Hoard", tagline: 'Hold & Spin Jackpots', era: 'modern', + audio: { music: null, intro: null }, featureLabel: 'JACKPOT COINS', layout: { reels: 5, rows: 3 }, evaluation: 'lines', @@ -612,6 +618,25 @@ export const MACHINES = [ name: 'Gold Rush Gulch', tagline: 'Sticky Bandits & Mine Carts', era: 'modern', + // Per-machine audio overrides — the other machines reserve the same slots + // and can be filled in the same way later: + // music theme track (relative to assets/music/), replaces the shared + // soundtrack pool while this machine is open + // intro plays once when the machine view opens + // bandit plays when a spin lands at least one NEW sticky bandit + // (replaces the stock sticky-wild fx) + // dynamite tiered by sticks on the reels after the spin: index 0 = 1, + // 1 = 2, 2 = 3+; multiple cues play sequentially + audio: { + music: 'slots/gold-rush-gulch.mp3', + intro: 'assets/speech/slots/gold-rush-gulch-intro.mp3', + bandit: 'assets/speech/slots/gold-rush-gulch-bandit.mp3', + dynamite: [ + 'assets/speech/slots/gold-rush-one-dynomite.mp3', + 'assets/speech/slots/gold-rush-two-dynomites.mp3', + 'assets/speech/slots/gold-rush-triple-dynomite.mp3', + ], + }, featureLabel: 'PICK BONUS', layout: { reels: 5, rows: 3 }, evaluation: 'lines', @@ -699,6 +724,7 @@ export const MACHINES = [ name: 'Sugar Spin', tagline: 'Tumbling Candy Mountain', era: 'modern', + audio: { music: null, intro: null }, featureLabel: 'TUMBLE WINS', layout: { reels: 6, rows: 5 }, evaluation: 'scatterPays',