document.getElementById('startButton').addEventListener('click', startGame);…
- User
document.getElementById('startButton').addEventListener('click', startGame); document.getElementById('backToMenuButton').addEventListener('click', returnToMenu); document.getElementById('returnToMenuButton').addEventListener('click', returnToMenu);
let diamonds = 0; let currentSection = 1; let currentQuestion = 1; const maxSections = 10; const questionsPerSection = 10;
// 10 bölüm için 10 farklı set halinde sorular ve ipuçları const gameData = [ // Sorular ve ipuçları burada... ];
function startGame() { document.querySelector('.menu').style.display = 'none'; document.querySelector('.game').style.display = 'block'; loadQuestion(); }
function loadQuestion() { const questions = gameData[currentSection - 1].questions; const currentWordInfo = questions[currentQuestion - 1]; const word = currentWordInfo.word;
codelet hintArray = currentWordInfo.hints; document.getElementById('currentLevel').innerText = `Bölüm: ${currentSection} - Soru: ${currentQuestion}`; document.getElementById('mainWord').innerText = word.split('').map(() => '_').join(' '); document.getElementById('mainWord').classList.add('animated-word'); updateHints(hintArray, 3); extraHints = 3; // İpucu sayısını sıfırla}
function updateHints(hintArray, visibleHints) { const hintElements = document.querySelectorAll('#hints p'); hintElements.forEach((hintElement, index) => { if (index < visibleHints) { hintElement.style.display = 'block'; hintElement.innerText =
İpucu ${index + 1}: ${hintArray[index]}; hintElement.classList.add('animated-hint'); } else { hintElement.style.display = 'none'; } }); }document.getElementById('submitGuessButton').addEventListener('click', () => { const guess = document.getElementById('guessInput').value.toLowerCase(); const questions = gameData[currentSection - 1].questions; const currentWordInfo = questions[currentQuestion - 1]; const word = currentWordInfo.word; if (guess === word) { diamonds += 5; document.getElementById('feedback').innerText = 'Doğru tahmin!'; nextQuestion(); } else { document.getElementById('feedback').innerText = 'Yanlış tahmin. Tekrar dene!'; } document.getElementById('diamonds').innerText = diamonds; });
function nextQuestion() { if (currentQuestion < questionsPerSection) { currentQuestion++; loadQuestion(); } else if (currentSection < maxSections) { showNextLevelScreen(); } else { alert('Tebrikler, oyunu kazandınız!'); } }
function showNextLevelScreen() { document.querySelector('.game').style.display = 'none'; document.querySelector('.next-level').style.display = 'block'; document.getElementById('nextLevelButton').innerText = ; }
- Assistant
- User
bu koda 10 bölümlük her bölümde 10 soru olacak şekilde eklemeler yap
- Assistant