Session 11: Golden Starbloom random event (clickable bonus + production boost)
This commit is contained in:
+40
@@ -161,6 +161,46 @@ const Audio = {
|
||||
sparkle.start(startTime);
|
||||
sparkle.stop(startTime + 0.2);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Play golden starbloom sound - an ethereal shimmering arpeggio with a
|
||||
* rising sweep, to distinguish it from regular purchase sounds.
|
||||
*/
|
||||
playGoldenBloom() {
|
||||
if (!this.ctx) return;
|
||||
this.resume();
|
||||
|
||||
const now = this.ctx.currentTime;
|
||||
|
||||
// Rising magical sweep (like the prestige sound but brighter).
|
||||
const sweep = this.ctx.createOscillator();
|
||||
const sweepGain = this.ctx.createGain();
|
||||
sweep.connect(sweepGain);
|
||||
sweepGain.connect(this.ctx.destination);
|
||||
sweep.type = 'sine';
|
||||
sweep.frequency.setValueAtTime(300, now);
|
||||
sweep.frequency.exponentialRampToValueAtTime(1200, now + 0.6);
|
||||
sweepGain.gain.setValueAtTime(0.18, now);
|
||||
sweepGain.gain.exponentialRampToValueAtTime(0.01, now + 0.7);
|
||||
sweep.start(now);
|
||||
sweep.stop(now + 0.7);
|
||||
|
||||
// A bright, ascending shimmer chord played quickly.
|
||||
const shimmerNotes = [1046.5, 1318.5, 1568.0, 2093.0]; // C5, E5, G5, C6
|
||||
shimmerNotes.forEach((freq, i) => {
|
||||
const osc = this.ctx.createOscillator();
|
||||
const gain = this.ctx.createGain();
|
||||
osc.connect(gain);
|
||||
gain.connect(this.ctx.destination);
|
||||
osc.frequency.value = freq;
|
||||
osc.type = 'triangle';
|
||||
const startTime = now + 0.05 + i * 0.06;
|
||||
gain.gain.setValueAtTime(0.1, startTime);
|
||||
gain.gain.exponentialRampToValueAtTime(0.01, startTime + 0.25);
|
||||
osc.start(startTime);
|
||||
osc.stop(startTime + 0.25);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user