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:
Joel Brock
2026-06-20 11:54:48 -07:00
parent 3a4c2579a5
commit 185845f969
2 changed files with 8 additions and 6 deletions
+7 -5
View File
@@ -569,7 +569,8 @@ document.addEventListener('DOMContentLoaded', () => {
turtleAgeVal.textContent = formatAge(turtleAge);
applyGrowthStage();
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() {
// Each line carries the voice clip that matches it (null = no audio).
const thoughts = [
"I think I grew a little! 🌱",
"Getting stronger! 💪",
"My shell feels bigger! 🐢",
"Another day in the deep blue 🌊"
{ text: "I think I grew a little! 🌱", voice: 'grewALittle' },
{ text: "Getting stronger! 💪", voice: null },
{ text: "My shell feels bigger! 🐢", voice: null },
{ text: "Another day in the deep blue 🌊", voice: 'deepBlue' }
];
return thoughts[Math.floor(Math.random() * thoughts.length)];
}
+1 -1
View File
@@ -1,4 +1,4 @@
const CACHE_NAME = 'tortugotchi-v14';
const CACHE_NAME = 'tortugotchi-v15';
const ASSETS = [
'./',
'./index.html',