From 185845f969b2fb2f0eaa1b894b9ec8bf784db327 Mon Sep 17 00:00:00 2001 From: Joel Brock Date: Sat, 20 Jun 2026 11:54:48 -0700 Subject: [PATCH] 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. --- app.js | 12 +++++++----- sw.js | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index c6bd745..d4e5b23 100644 --- a/app.js +++ b/app.js @@ -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)]; } diff --git a/sw.js b/sw.js index 92079d5..e328470 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -const CACHE_NAME = 'tortugotchi-v14'; +const CACHE_NAME = 'tortugotchi-v15'; const ASSETS = [ './', './index.html',