diff --git a/src/game/game.js b/src/game/game.js index 97cc3ad..4d941cc 100644 --- a/src/game/game.js +++ b/src/game/game.js @@ -1,12 +1,13 @@ let score = 0; let combo = 0; let currentQuestionIndex = 0; -let timeLeft = 60; // 60 seconds for the quiz +let timeLeft = 60; let timer; let questions; let timeout; -let wrongQuestions = []; // Track wrong questions +let wrongQuestions = [] let maxCombo = 0; +let wrongQuestionIndex = 0; const bgmElement = document.getElementById('bgm'); const bgmEndElement = document.getElementById('bgm_end'); @@ -74,7 +75,6 @@ function generateRandomQuestions(numQuestions) { return questions; } - function loadQuestion() { const questionElement = document.getElementById('question'); const optionsElements = document.querySelectorAll('.option'); @@ -147,7 +147,6 @@ function checkAnswer(selectedOptionIndex) { options.forEach(option => option.disabled = true); } - function updateProgressBar() { const progressBar = document.getElementById('progress-bar'); const star1 = document.getElementById('star1'); @@ -179,7 +178,6 @@ function updateProgressBar() { } } - function nextQuestion() { clearTimeout(timeout); currentQuestionIndex += 1; @@ -242,6 +240,7 @@ function endQuiz() { // Show restart button at the end document.getElementById('restart-button').classList.remove('hidden'); + document.getElementById('return-button').classList.remove('hidden'); if (wrongQuestions.length > 0) { document.getElementById('wrong-questions-container').classList.remove('hidden'); @@ -259,9 +258,6 @@ function endQuiz() { bgmEndElement.play(); } - -let wrongQuestionIndex = 0; - function showWrongQuestion(index) { const wrongQuestion = wrongQuestions[index]; document.getElementById('wrong-question-number').textContent = `Question ${wrongQuestion.questionNumber}`; diff --git a/src/game/main.css b/src/game/main.css index 9095c5e..83195cb 100644 --- a/src/game/main.css +++ b/src/game/main.css @@ -286,7 +286,8 @@ body { #prev-wrong-button, #next-wrong-button, #next-button, -#restart-button { +#restart-button, +#return-button { padding: 10px 20px; margin: 5px; font-size: 16px; diff --git a/src/game/main.html b/src/game/main.html index ddcb0ec..6a7a205 100644 --- a/src/game/main.html +++ b/src/game/main.html @@ -83,10 +83,14 @@