Add hint cooldown and raise player limit to 15
- Lock hint button for 10s per riddle with live countdown display - Clear hint timer when player finishes their race - Raise max players from 8 to 15 with 15 distinct player colors Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ let myRoomId = null;
|
||||
let amHost = false;
|
||||
let myFinished = false;
|
||||
let carEmojiMap = {}; // playerId → car emoji
|
||||
let hintTimer = null; // countdown interval for hint button
|
||||
|
||||
// ── Screen helpers ─────────────────────
|
||||
const screens = {
|
||||
@@ -225,6 +226,28 @@ function showRiddle(riddle, num, total) {
|
||||
hintBox.style.display = 'none';
|
||||
hintText.textContent = '';
|
||||
answerInput.focus();
|
||||
startHintCountdown();
|
||||
}
|
||||
|
||||
function startHintCountdown() {
|
||||
clearInterval(hintTimer);
|
||||
hintBox.style.display = 'none';
|
||||
hintBtn.disabled = true;
|
||||
|
||||
let remaining = 10;
|
||||
hintBtn.textContent = `💡 Hint (${remaining}s)`;
|
||||
|
||||
hintTimer = setInterval(() => {
|
||||
remaining--;
|
||||
if (remaining <= 0) {
|
||||
clearInterval(hintTimer);
|
||||
hintTimer = null;
|
||||
hintBtn.disabled = false;
|
||||
hintBtn.textContent = '💡 Hint';
|
||||
} else {
|
||||
hintBtn.textContent = `💡 Hint (${remaining}s)`;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function setFeedback(msg, isCorrect) {
|
||||
@@ -359,6 +382,8 @@ socket.on('answerResult', ({ correct, finished, finishPosition, riddle, riddleNu
|
||||
|
||||
if (finished) {
|
||||
myFinished = true;
|
||||
clearInterval(hintTimer);
|
||||
hintTimer = null;
|
||||
progressFill.style.width = '100%';
|
||||
riddlePanel.style.display = 'none';
|
||||
finishedBanner.style.display = 'flex';
|
||||
|
||||
Reference in New Issue
Block a user