From 08d9eedf5d4431234002ea684b6b650867a47628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Flusin?= Date: Thu, 11 Jun 2026 17:19:59 +0200 Subject: [PATCH] feat: adds easy mode --- index.html | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/index.html b/index.html index 1381939..ac5ab57 100644 --- a/index.html +++ b/index.html @@ -268,6 +268,40 @@ body { .no-queen-note em { color: #c09060; font-style: normal; } .no-queen-note strong { color: #ffd060; } +/* ── Difficulty selector ── */ +#difficulty-select { + display: flex; flex-direction: column; + align-items: center; gap: 7px; + margin-bottom: 1.2rem; +} +.diff-label { + font-size: .62rem; color: #906040; letter-spacing: .22em; + text-transform: uppercase; font-weight: 900; +} +.diff-options { display: flex; gap: 10px; } +.diff-btn { + background: rgba(0,0,0,.4); + border: 2px solid rgba(255,214,0,.18); + color: #c09060; + padding: .48rem 1.4rem; + font-family: inherit; font-size: .82rem; font-weight: 900; + border-radius: 12px; cursor: pointer; + transition: border-color .15s, background .15s, color .15s; + text-align: center; line-height: 1.5; +} +.diff-btn small { display: block; font-size: .68rem; font-weight: 700; color: #604030; } +.diff-btn.active { + border-color: #FFD600; + background: rgba(255,214,0,.1); + color: #ffe066; +} +.diff-btn.active small { color: #b08050; } +.diff-btn:hover:not(.active) { + border-color: rgba(255,214,0,.4); + background: rgba(255,214,0,.05); + color: #d0a070; +} + /* ── End screen ── */ #end-screen { gap: 0; display: none; } .end-lbl { font-size: .78rem; color: #ffa000; letter-spacing: .22em; text-transform: uppercase; font-weight: 900; } @@ -345,6 +379,14 @@ body { +
+
Difficulté
+
+ + +
+
+
⚠ Dans certains cadres, il n'y a aucune Reine. Utilisez Pas de Reine si vous en êtes certain·e. @@ -410,6 +452,12 @@ const CFG = { FEEDBACK_MS: 1700, }; +// ───────────────────────────────────────────────────── +// Difficulty +// ───────────────────────────────────────────────────── +let easyMode = false; +const DOT_COLORS = ['#ffffff', '#ff2020', '#ffd600', '#00ee55', '#2090ff']; + // ───────────────────────────────────────────────────── // Canvas & context // ───────────────────────────────────────────────────── @@ -599,6 +647,7 @@ class Bee { this.x = x; this.y = y; this.type = type; this.layer = layer; + this.dotColor = type === 'queen' ? DOT_COLORS[(Math.random() * DOT_COLORS.length) | 0] : null; const BASE = { worker: 1.3, drone: 1.0, queen: 0.6 }; this.spd = BASE[type] * (.65 + Math.random() * .7) * CFG.BEE_SPEED; @@ -648,6 +697,14 @@ class Bee { ctx.translate(this.x, this.y); ctx.rotate(this.rot); ctx.drawImage(sp, -sp.width * .5, -sp.height * .5); + if (easyMode && this.dotColor) { + // PNG sprites (IMAGE_ROTATION=90): head faces +X. Placeholder: head faces -X. + // 30% from head in original portrait image = sp.width*0.20 from center after 90° rotation. + const hx = CFG.IMAGES.queen ? sp.width * 0.20 : -sp.width * 0.20; + ctx.beginPath(); ctx.arc(hx, 0, 3, 0, Math.PI * 2); + ctx.fillStyle = this.dotColor; ctx.fill(); + ctx.strokeStyle = this.dotColor; ctx.lineWidth = 1.5; ctx.stroke(); + } ctx.restore(); } } @@ -1158,6 +1215,14 @@ const AUDIO = (() => { // ───────────────────────────────────────────────────── // Input // ───────────────────────────────────────────────────── +document.querySelectorAll('.diff-btn').forEach(btn => { + btn.addEventListener('click', () => { + document.querySelectorAll('.diff-btn').forEach(b => b.classList.remove('active')); + btn.classList.add('active'); + easyMode = btn.dataset.mode === 'easy'; + }); +}); + canvas.addEventListener('click', e => { const r = canvas.getBoundingClientRect(); G.onCanvasClick(e.clientX - r.left, e.clientY - r.top);