v2.1 — guide statique (pas de clignotement), voix sans 'majuscule', énonce le mot à épeler + rappel si inactif

This commit is contained in:
Poulpe
2026-06-17 17:11:19 +00:00
parent 17d64c3561
commit 29deac7a95
3 changed files with 17 additions and 14 deletions

16
game.js
View File

@@ -287,7 +287,7 @@ function recomputeFocus(announce = false) {
state.focus = f; state.focus = f;
renderClue(); renderClue();
applyGuide(); applyGuide();
if (announce && changed && f && state.cat.kind === "imagier") { if (announce && changed && f) {
setTimeout(() => mascotSay("Écris : " + f + " ! ✏️", "happy"), 250); setTimeout(() => mascotSay("Écris : " + f + " ! ✏️", "happy"), 250);
} }
} }
@@ -313,7 +313,7 @@ function inputLetter(ch) {
state.current += ch; state.current += ch;
renderWord(true); renderWord(true);
sndType(); sndType();
if (data.guided) say(ch, { interrupt: true }); // lit la lettre if (data.guided) say(ch.toLowerCase(), { interrupt: true }); // lit la lettre (minuscule = pas de "majuscule")
spawnBubbles(window.innerWidth / 2, window.innerHeight * 0.32, 6); spawnBubbles(window.innerWidth / 2, window.innerHeight * 0.32, 6);
checkWord(); checkWord();
recomputeFocus(); recomputeFocus();
@@ -375,16 +375,18 @@ function clearHint() { document.querySelectorAll(".chip.hint").forEach(c => c.cl
function checkIdle() { function checkIdle() {
if (!state.running || state.miniGame) return; if (!state.running || state.miniGame) return;
const idle = (now() - state.lastAction) / 1000; const idle = (now() - state.lastAction) / 1000;
if (idle > 5 && !state.hintShown) { if (idle > 5) {
state.hintShown = true; const sinceHint = (now() - (state.lastHint || 0)) / 1000;
if (sinceHint > 6) {
state.lastHint = now();
const w = state.focus || state.targets.find(x => !state.found.has(x)); const w = state.focus || state.targets.find(x => !state.found.has(x));
if (w) { if (w) {
const chip = elWordList.querySelector(`.chip[data-word="${w}"]`); const chip = elWordList.querySelector(`.chip[data-word="${w}"]`);
if (chip) chip.classList.add("hint"); if (chip) chip.classList.add("hint");
mascotSay("Essaie d'écrire " + w + " ! 💡", "happy"); mascotSay("Écris : " + w + " ! 💡", "happy");
}
} }
} }
if (idle > 13) { mascotSet("sleep"); elSpeech.textContent = "Zzz… joue avec moi ! 😴"; elSpeech.classList.add("show"); }
} }
/* ================================================================== */ /* ================================================================== */
@@ -555,7 +557,7 @@ function startCategory(cat) {
blinkLoop(); blinkLoop();
try { ac().resume(); } catch (e) {} try { ac().resume(); } catch (e) {}
mascotSay(greeting(), "happy"); mascotSay(greeting(), "happy");
if (cat.kind === "imagier") recomputeFocus(true); recomputeFocus(true);
} }
/* ================================================================== */ /* ================================================================== */

View File

@@ -364,12 +364,13 @@ html, body {
/* ---------- Lettre guidée ---------- */ /* ---------- Lettre guidée ---------- */
.key.guide { .key.guide {
animation: guidePulse .8s ease infinite;
outline: 4px solid #fff; outline: 4px solid #fff;
outline-offset: -2px; outline-offset: -2px;
transform: scale(1.08);
filter: brightness(1.25);
box-shadow: 0 0 0 4px rgba(106,92,255,.45), 0 8px 18px rgba(0,0,0,.25);
z-index: 1; z-index: 1;
} }
@keyframes guidePulse { 0%,100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.12); filter: brightness(1.35); } }
/* ---------- Espace parents ---------- */ /* ---------- Espace parents ---------- */
.parent-card { max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; text-align: left; } .parent-card { max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; text-align: left; }

2
sw.js
View File

@@ -1,5 +1,5 @@
/* Service worker — network-first (frais en ligne, cache en secours hors-ligne) */ /* Service worker — network-first (frais en ligne, cache en secours hors-ligne) */
const CACHE = "lettres-magiques-v3"; const CACHE = "lettres-magiques-v4";
const ASSETS = [ const ASSETS = [
".", ".",
"index.html", "index.html",