Update hagmangame_en.html

This commit is contained in:
FURK4NGG
2025-08-31 13:16:58 +03:00
committed by GitHub
parent 12d3e4817a
commit 7832c93dd8
+1 -1
View File
@@ -58,4 +58,4 @@ const gameOver=(isWin)=>{if(isWin){score++;scoreDisplay.innerText = score;}else{
const initGame=(button,clickedLetter)=>{if(currentWord.includes(clickedLetter)){[...currentWord].forEach((letter,index)=>{if(letter===clickedLetter){correctLetters.push(letter);wordDisplay.querySelectorAll("li")[index].innerText=letter;wordDisplay.querySelectorAll("li")[index].classList.add("guessed");}});} else {wrongGuessCount++;hangmanImage.src=`img/hangman-${wrongGuessCount}.svg`;}button.disabled=true;guessesText.innerText=`${wrongGuessCount} / ${maxGuesses}`;if(wrongGuessCount===maxGuesses) return gameOver(false);if(correctLetters.length===currentWord.length) return gameOver(true);}
// İngilizce harfler
for(let e=97;e<=122;e++){const btn=document.createElement("button");btn.innerText=String.fromCharCode(e);keyboardDiv.appendChild(btn);btn.addEventListener("click",()=>initGame(btn,String.fromCharCode(e)));}getRandomWord();playAgainBtn.addEventListener("click",getRandomWord);</script></body></html>
for(let e=97;e<=122;e++){const btn=document.createElement("button");const char = String.fromCharCode(e);btn.innerText=String.fromCharCode(e);btn.setAttribute("aria-label", `Letter ${char}`);keyboardDiv.appendChild(btn);btn.addEventListener("click",()=>initGame(btn,String.fromCharCode(e)));}getRandomWord();playAgainBtn.addEventListener("click",getRandomWord);</script></body></html>