Fix growth speech bubble / voice mismatch
Pair each growth thought with its matching voice clip instead of always playing 'I think I grew a little'. Lines without a matching clip now play no audio, and 'Another day in the deep blue' plays the deepBlue clip. Bump SW to v15.
This commit is contained in:
@@ -569,7 +569,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
turtleAgeVal.textContent = formatAge(turtleAge);
|
turtleAgeVal.textContent = formatAge(turtleAge);
|
||||||
applyGrowthStage();
|
applyGrowthStage();
|
||||||
if (wholeDays > 0 && Math.random() > 0.7) {
|
if (wholeDays > 0 && Math.random() > 0.7) {
|
||||||
triggerThoughtBubble(getGrowthThought(), 2200, 'grewALittle');
|
const growth = getGrowthThought();
|
||||||
|
triggerThoughtBubble(growth.text, 2200, growth.voice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,11 +772,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getGrowthThought() {
|
function getGrowthThought() {
|
||||||
|
// Each line carries the voice clip that matches it (null = no audio).
|
||||||
const thoughts = [
|
const thoughts = [
|
||||||
"I think I grew a little! 🌱",
|
{ text: "I think I grew a little! 🌱", voice: 'grewALittle' },
|
||||||
"Getting stronger! 💪",
|
{ text: "Getting stronger! 💪", voice: null },
|
||||||
"My shell feels bigger! 🐢",
|
{ text: "My shell feels bigger! 🐢", voice: null },
|
||||||
"Another day in the deep blue 🌊"
|
{ text: "Another day in the deep blue 🌊", voice: 'deepBlue' }
|
||||||
];
|
];
|
||||||
return thoughts[Math.floor(Math.random() * thoughts.length)];
|
return thoughts[Math.floor(Math.random() * thoughts.length)];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user