feat(04-04): wire audio and speech into lesson, reward, forest, and app

- playCorrectSound() on correct keypress in letter and word exercises
- playRewardSound() when reward image appears
- speakText() for companion comment on reward screen
- playForestElementSound() when new forest element renders
- speakText() for companion greeting on forest screen

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 18:22:40 +02:00
co-authored by Claude Opus 4.6
parent a55238f1f9
commit b453efebb4
4 changed files with 20 additions and 9 deletions
+3
View File
@@ -19,6 +19,7 @@ import { renderKeyboard, highlightKey, pressKey } from "../game/keyboard";
import { getLevelByNumber } from "../game/levels";
import { getLetterIntro } from "../companion/companion";
import { getWordsForLevel } from "../game/words";
import { playCorrectSound } from "../audio/sounds";
export function initWelcomeScreen(
db: IDBDatabase,
@@ -213,6 +214,7 @@ export function initLessonScreen(
if (result.correct) {
cumulativeCorrect++;
playCorrectSound();
const currentEl = letterArea.querySelector(".falling-letter");
if (currentEl) {
currentEl.classList.add("falling-letter--dissolve");
@@ -288,6 +290,7 @@ export function initLessonScreen(
if (result.correct) {
cumulativeCorrect++;
playCorrectSound();
if (result.exerciseComplete) {
document.removeEventListener("keydown", onKeyDown);