Spaces:
Running
Running
Add 1 files
Browse files- index.html +241 -19
index.html
CHANGED
|
@@ -35,6 +35,15 @@
|
|
| 35 |
background-color: #f00;
|
| 36 |
opacity: 0;
|
| 37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
</style>
|
| 39 |
</head>
|
| 40 |
<body class="bg-blue-50 min-h-screen flex flex-col items-center font-sans">
|
|
@@ -49,25 +58,26 @@
|
|
| 49 |
<div class="flex flex-col md:flex-row gap-8">
|
| 50 |
<!-- Hangman Drawing -->
|
| 51 |
<div class="w-full md:w-1/2 flex flex-col items-center">
|
| 52 |
-
<div class="relative w-
|
| 53 |
<!-- Gallows -->
|
| 54 |
-
<div class="absolute top-0 left-1/2 transform -translate-x-1/2 w-1 h-
|
| 55 |
-
<div class="absolute top-0 left-1/4 w-1/2 h-1 bg-gray-800"></div>
|
| 56 |
-
<div class="absolute top-0 left-1/4 w-1 h-
|
| 57 |
-
<div class="absolute bottom-0 left-0 w-
|
| 58 |
|
| 59 |
<!-- Hangman Parts -->
|
| 60 |
-
<div id="head" class="hangman-part absolute top-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
<div id="face" class="hangman-part absolute top-10 left-1/2 transform -translate-x-1/2 flex justify-between w-6">
|
| 67 |
-
<div class="w-2 h-2 rounded-full bg-gray-800"></div>
|
| 68 |
-
<div class="w-2 h-2 rounded-full bg-gray-800"></div>
|
| 69 |
</div>
|
| 70 |
-
<div id="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
</div>
|
| 72 |
|
| 73 |
<div class="text-center">
|
|
@@ -107,6 +117,35 @@
|
|
| 107 |
</div>
|
| 108 |
</div>
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
<div class="w-full max-w-4xl bg-white rounded-xl shadow-lg p-6">
|
| 111 |
<h2 class="text-xl font-bold mb-4 text-center">Wie spielt man?</h2>
|
| 112 |
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
@@ -141,6 +180,11 @@
|
|
| 141 |
</div>
|
| 142 |
</footer>
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
<script>
|
| 145 |
document.addEventListener('DOMContentLoaded', function() {
|
| 146 |
// Game words with categories and hints (easy German words)
|
|
@@ -152,7 +196,12 @@
|
|
| 152 |
{ word: "KATZE", hint: "Schnurrt und hat weiche Pfoten" },
|
| 153 |
{ word: "FISCH", hint: "Schwimmt im Wasser und atmet durch Kiemen" },
|
| 154 |
{ word: "VOGEL", hint: "Hat Federn und kann fliegen" },
|
| 155 |
-
{ word: "MAUS", hint: "Klein, schnell und mag Käse" }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
]
|
| 157 |
},
|
| 158 |
schule: {
|
|
@@ -162,7 +211,12 @@
|
|
| 162 |
{ word: "STIFT", hint: "Damit schreibt oder malt man" },
|
| 163 |
{ word: "TASCHE", hint: "Trägt man auf dem Rücken mit Schulmaterial" },
|
| 164 |
{ word: "LEHRER", hint: "Bringt Kindern etwas bei" },
|
| 165 |
-
{ word: "KREIDE", hint: "Damit schreibt man an die Tafel" }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
]
|
| 167 |
},
|
| 168 |
spielzeug: {
|
|
@@ -172,7 +226,57 @@
|
|
| 172 |
{ word: "PUPPE", hint: "Sieht aus wie ein Baby oder eine Person" },
|
| 173 |
{ word: "AUTO", hint: "Hat Räder und man kann es schieben" },
|
| 174 |
{ word: "BAUER", hint: "Damit kann man Türme und Häuser bauen" },
|
| 175 |
-
{ word: "PUZZLE", hint: "Viele Teile, die zusammengesetzt werden müssen" }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
]
|
| 177 |
}
|
| 178 |
};
|
|
@@ -185,6 +289,9 @@
|
|
| 185 |
let hintUsed = false;
|
| 186 |
let currentCategory = "";
|
| 187 |
let gameActive = true;
|
|
|
|
|
|
|
|
|
|
| 188 |
|
| 189 |
// DOM elements
|
| 190 |
const wordDisplay = document.getElementById('word-display');
|
|
@@ -197,10 +304,20 @@
|
|
| 197 |
const hintArea = document.getElementById('hint-area');
|
| 198 |
const hintText = document.getElementById('hint-text');
|
| 199 |
const categoryDisplay = document.getElementById('category');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 200 |
const hangmanParts = [
|
| 201 |
'head', 'body', 'left-arm', 'right-arm',
|
| 202 |
-
'left-leg', 'right-leg'
|
| 203 |
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
|
| 205 |
// Initialize the game
|
| 206 |
function initGame() {
|
|
@@ -216,12 +333,17 @@
|
|
| 216 |
message.classList.add('hidden');
|
| 217 |
newGameButton.classList.add('hidden');
|
| 218 |
hintArea.classList.add('hidden');
|
|
|
|
| 219 |
|
| 220 |
// Reset hangman
|
| 221 |
hangmanParts.forEach(part => {
|
| 222 |
document.getElementById(part).classList.remove('visible');
|
| 223 |
});
|
| 224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
// Select a random category
|
| 226 |
const categories = Object.keys(wordCategories);
|
| 227 |
currentCategory = categories[Math.floor(Math.random() * categories.length)];
|
|
@@ -237,6 +359,9 @@
|
|
| 237 |
updateMistakesDisplay();
|
| 238 |
createWordDisplay();
|
| 239 |
createKeyboard();
|
|
|
|
|
|
|
|
|
|
| 240 |
}
|
| 241 |
|
| 242 |
// Create the word display with blanks
|
|
@@ -294,6 +419,10 @@
|
|
| 294 |
button.classList.add('bounce');
|
| 295 |
setTimeout(() => button.classList.remove('bounce'), 500);
|
| 296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
createWordDisplay();
|
| 298 |
checkWin();
|
| 299 |
} else {
|
|
@@ -303,6 +432,10 @@
|
|
| 303 |
button.classList.add('bounce');
|
| 304 |
setTimeout(() => button.classList.remove('bounce'), 500);
|
| 305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
mistakes++;
|
| 307 |
updateMistakesDisplay();
|
| 308 |
showHangmanPart();
|
|
@@ -315,6 +448,12 @@
|
|
| 315 |
if (mistakes <= hangmanParts.length) {
|
| 316 |
const part = hangmanParts[mistakes - 1];
|
| 317 |
document.getElementById(part).classList.add('visible');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
}
|
| 319 |
}
|
| 320 |
|
|
@@ -345,6 +484,13 @@
|
|
| 345 |
message.classList.remove('hidden');
|
| 346 |
message.classList.add('bg-green-100', 'text-green-800');
|
| 347 |
newGameButton.classList.remove('hidden');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
createConfetti();
|
| 349 |
}
|
| 350 |
}
|
|
@@ -358,6 +504,13 @@
|
|
| 358 |
message.classList.add('bg-red-100', 'text-red-800');
|
| 359 |
newGameButton.classList.remove('hidden');
|
| 360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
// Reveal the word
|
| 362 |
revealWord();
|
| 363 |
}
|
|
@@ -382,6 +535,63 @@
|
|
| 382 |
}
|
| 383 |
}
|
| 384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
// Show hint
|
| 386 |
hintButton.addEventListener('click', function() {
|
| 387 |
if (!hintUsed && gameActive) {
|
|
@@ -394,6 +604,17 @@
|
|
| 394 |
// New game button
|
| 395 |
newGameButton.addEventListener('click', initGame);
|
| 396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
// Create confetti effect
|
| 398 |
function createConfetti() {
|
| 399 |
const colors = ['#f00', '#0f0', '#00f', '#ff0', '#f0f', '#0ff'];
|
|
@@ -425,6 +646,7 @@
|
|
| 425 |
|
| 426 |
// Start the game
|
| 427 |
initGame();
|
|
|
|
| 428 |
});
|
| 429 |
</script>
|
| 430 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ThetaPhiPsi/noras-hangman" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
|
|
|
| 35 |
background-color: #f00;
|
| 36 |
opacity: 0;
|
| 37 |
}
|
| 38 |
+
.hangman-face {
|
| 39 |
+
transition: all 0.3s ease;
|
| 40 |
+
}
|
| 41 |
+
.happy-face {
|
| 42 |
+
transform: rotate(0deg);
|
| 43 |
+
}
|
| 44 |
+
.sad-face {
|
| 45 |
+
transform: rotate(180deg);
|
| 46 |
+
}
|
| 47 |
</style>
|
| 48 |
</head>
|
| 49 |
<body class="bg-blue-50 min-h-screen flex flex-col items-center font-sans">
|
|
|
|
| 58 |
<div class="flex flex-col md:flex-row gap-8">
|
| 59 |
<!-- Hangman Drawing -->
|
| 60 |
<div class="w-full md:w-1/2 flex flex-col items-center">
|
| 61 |
+
<div class="relative w-64 h-64 mb-6">
|
| 62 |
<!-- Gallows -->
|
| 63 |
+
<div class="absolute top-0 left-1/2 transform -translate-x-1/2 w-1 h-10 bg-gray-800 rounded"></div>
|
| 64 |
+
<div class="absolute top-0 left-1/4 w-1/2 h-1 bg-gray-800 rounded"></div>
|
| 65 |
+
<div class="absolute top-0 left-1/4 w-1 h-64 bg-gray-800 rounded"></div>
|
| 66 |
+
<div class="absolute bottom-0 left-0 w-40 h-1 bg-gray-800 rounded"></div>
|
| 67 |
|
| 68 |
<!-- Hangman Parts -->
|
| 69 |
+
<div id="head" class="hangman-part absolute top-10 left-1/2 transform -translate-x-1/2 w-12 h-12 rounded-full border-4 border-gray-800">
|
| 70 |
+
<div id="face" class="hangman-face happy-face absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-8 h-4">
|
| 71 |
+
<div class="absolute top-0 left-0 w-2 h-2 bg-gray-800 rounded-full"></div>
|
| 72 |
+
<div class="absolute top-0 right-0 w-2 h-2 bg-gray-800 rounded-full"></div>
|
| 73 |
+
<div class="absolute bottom-0 left-1/2 transform -translate-x-1/2 w-4 h-1 bg-gray-800 rounded-full"></div>
|
| 74 |
+
</div>
|
|
|
|
|
|
|
|
|
|
| 75 |
</div>
|
| 76 |
+
<div id="body" class="hangman-part absolute top-22 left-1/2 transform -translate-x-1/2 w-1 h-16 bg-gray-800 rounded"></div>
|
| 77 |
+
<div id="left-arm" class="hangman-part absolute top-24 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-1 h-10 bg-gray-800 rounded origin-top rotate-45"></div>
|
| 78 |
+
<div id="right-arm" class="hangman-part absolute top-24 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-1 h-10 bg-gray-800 rounded origin-top -rotate-45"></div>
|
| 79 |
+
<div id="left-leg" class="hangman-part absolute top-38 left-1/2 transform -translate-x-1/2 w-1 h-10 bg-gray-800 rounded origin-top rotate-30"></div>
|
| 80 |
+
<div id="right-leg" class="hangman-part absolute top-38 left-1/2 transform -translate-x-1/2 w-1 h-10 bg-gray-800 rounded origin-top -rotate-30"></div>
|
| 81 |
</div>
|
| 82 |
|
| 83 |
<div class="text-center">
|
|
|
|
| 117 |
</div>
|
| 118 |
</div>
|
| 119 |
|
| 120 |
+
<!-- Game History -->
|
| 121 |
+
<div id="game-history" class="w-full max-w-4xl bg-white rounded-xl shadow-lg p-6 mb-8 hidden">
|
| 122 |
+
<h2 class="text-xl font-bold mb-4 text-center">Deine Spiele</h2>
|
| 123 |
+
<div class="overflow-x-auto">
|
| 124 |
+
<table class="w-full">
|
| 125 |
+
<thead>
|
| 126 |
+
<tr class="bg-gray-100">
|
| 127 |
+
<th class="px-4 py-2 text-left">Datum</th>
|
| 128 |
+
<th class="px-4 py-2 text-left">Wort</th>
|
| 129 |
+
<th class="px-4 py-2 text-left">Ergebnis</th>
|
| 130 |
+
<th class="px-4 py-2 text-left">Fehler</th>
|
| 131 |
+
</tr>
|
| 132 |
+
</thead>
|
| 133 |
+
<tbody id="history-table">
|
| 134 |
+
<!-- Filled by JavaScript -->
|
| 135 |
+
</tbody>
|
| 136 |
+
</table>
|
| 137 |
+
</div>
|
| 138 |
+
<div class="mt-4 flex justify-between items-center">
|
| 139 |
+
<div>
|
| 140 |
+
<p class="font-semibold">Statistik:</p>
|
| 141 |
+
<p>Gewonnen: <span id="wins">0</span> | Verloren: <span id="losses">0</span></p>
|
| 142 |
+
</div>
|
| 143 |
+
<button id="toggle-history" class="bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium py-2 px-4 rounded-lg transition-colors">
|
| 144 |
+
<i class="fas fa-eye-slash mr-2"></i>Verstecken
|
| 145 |
+
</button>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
<div class="w-full max-w-4xl bg-white rounded-xl shadow-lg p-6">
|
| 150 |
<h2 class="text-xl font-bold mb-4 text-center">Wie spielt man?</h2>
|
| 151 |
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
|
|
| 180 |
</div>
|
| 181 |
</footer>
|
| 182 |
|
| 183 |
+
<audio id="correct-sound" src="https://assets.mixkit.co/sfx/preview/mixkit-correct-answer-tone-2870.mp3" preload="auto"></audio>
|
| 184 |
+
<audio id="wrong-sound" src="https://assets.mixkit.co/sfx/preview/mixkit-wrong-answer-fail-notification-946.mp3" preload="auto"></audio>
|
| 185 |
+
<audio id="win-sound" src="https://assets.mixkit.co/sfx/preview/mixkit-achievement-bell-600.mp3" preload="auto"></audio>
|
| 186 |
+
<audio id="lose-sound" src="https://assets.mixkit.co/sfx/preview/mixkit-sad-game-over-675.mp3" preload="auto"></audio>
|
| 187 |
+
|
| 188 |
<script>
|
| 189 |
document.addEventListener('DOMContentLoaded', function() {
|
| 190 |
// Game words with categories and hints (easy German words)
|
|
|
|
| 196 |
{ word: "KATZE", hint: "Schnurrt und hat weiche Pfoten" },
|
| 197 |
{ word: "FISCH", hint: "Schwimmt im Wasser und atmet durch Kiemen" },
|
| 198 |
{ word: "VOGEL", hint: "Hat Federn und kann fliegen" },
|
| 199 |
+
{ word: "MAUS", hint: "Klein, schnell und mag Käse" },
|
| 200 |
+
{ word: "PFERD", hint: "Groß, hat eine Mähne und man kann darauf reiten" },
|
| 201 |
+
{ word: "KUH", hint: "Gibt Milch und sagt 'Muh'" },
|
| 202 |
+
{ word: "HASE", hint: "Hat lange Ohren und hoppelt" },
|
| 203 |
+
{ word: "ENTE", hint: "Schwimmt auf dem Teich und sagt 'Quak'" },
|
| 204 |
+
{ word: "SCHWEIN", hint: "Ist rosa und wühlt im Schlamm" }
|
| 205 |
]
|
| 206 |
},
|
| 207 |
schule: {
|
|
|
|
| 211 |
{ word: "STIFT", hint: "Damit schreibt oder malt man" },
|
| 212 |
{ word: "TASCHE", hint: "Trägt man auf dem Rücken mit Schulmaterial" },
|
| 213 |
{ word: "LEHRER", hint: "Bringt Kindern etwas bei" },
|
| 214 |
+
{ word: "KREIDE", hint: "Damit schreibt man an die Tafel" },
|
| 215 |
+
{ word: "LINEAL", hint: "Gerades Werkzeug zum Zeichnen von Linien" },
|
| 216 |
+
{ word: "RADIERER", hint: "Damit entfernt man Bleistiftstriche" },
|
| 217 |
+
{ word: "HEFT", hint: "Hat leere Seiten zum Schreiben" },
|
| 218 |
+
{ word: "FARBE", hint: "Damit malt man bunte Bilder" },
|
| 219 |
+
{ word: "SCHERE", hint: "Damit schneidet man Papier" }
|
| 220 |
]
|
| 221 |
},
|
| 222 |
spielzeug: {
|
|
|
|
| 226 |
{ word: "PUPPE", hint: "Sieht aus wie ein Baby oder eine Person" },
|
| 227 |
{ word: "AUTO", hint: "Hat Räder und man kann es schieben" },
|
| 228 |
{ word: "BAUER", hint: "Damit kann man Türme und Häuser bauen" },
|
| 229 |
+
{ word: "PUZZLE", hint: "Viele Teile, die zusammengesetzt werden müssen" },
|
| 230 |
+
{ word: "SEIL", hint: "Langes Ding zum Springen oder Klettern" },
|
| 231 |
+
{ word: "SPIELKARTEN", hint: "Damit kann man viele verschiedene Spiele spielen" },
|
| 232 |
+
{ word: "TEDDY", hint: "Weicher Bär zum Kuscheln" },
|
| 233 |
+
{ word: "SPIELUHR", hint: "Spielt Musik wenn man sie aufzieht" },
|
| 234 |
+
{ word: "KNETE", hint: "Weiches Material zum Formen von Figuren" }
|
| 235 |
+
]
|
| 236 |
+
},
|
| 237 |
+
essen: {
|
| 238 |
+
name: "Essen",
|
| 239 |
+
words: [
|
| 240 |
+
{ word: "APFEL", hint: "Rund, rot oder grün und sehr gesund" },
|
| 241 |
+
{ word: "BANANE", hint: "Länglich, gelb und kommt von Bäumen" },
|
| 242 |
+
{ word: "BROT", hint: "Wird aus Mehl gebacken und ist meistens braun" },
|
| 243 |
+
{ word: "KAESE", hint: "Kommt von der Kuh und ist oft gelb" },
|
| 244 |
+
{ word: "EI", hint: "Kommt von Hühnern und hat eine harte Schale" },
|
| 245 |
+
{ word: "SUPPE", hint: "Flüssiges Essen, das man löffelt" },
|
| 246 |
+
{ word: "NUDELN", hint: "Lange, dünne Teigwaren aus Italien" },
|
| 247 |
+
{ word: "EIS", hint: "Kalt, süß und schmilzt in der Sonne" },
|
| 248 |
+
{ word: "KEKS", hint: "Klein, knusprig und oft mit Schokolade" },
|
| 249 |
+
{ word: "MARMELADE", hint: "Süßer Brotaufstrich aus Früchten" }
|
| 250 |
+
]
|
| 251 |
+
},
|
| 252 |
+
familie: {
|
| 253 |
+
name: "Familie",
|
| 254 |
+
words: [
|
| 255 |
+
{ word: "MAMA", hint: "Die wichtigste Frau in deinem Leben" },
|
| 256 |
+
{ word: "PAPA", hint: "Der wichtigste Mann in deinem Leben" },
|
| 257 |
+
{ word: "OMA", hint: "Die Mutter deiner Mutter oder deines Vaters" },
|
| 258 |
+
{ word: "OPA", hint: "Der Vater deiner Mutter oder deines Vaters" },
|
| 259 |
+
{ word: "BRUDER", hint: "Ein männliches Geschwisterkind" },
|
| 260 |
+
{ word: "SCHWESTER", hint: "Ein weibliches Geschwisterkind" },
|
| 261 |
+
{ word: "TANTE", hint: "Die Schwester deiner Mutter oder deines Vaters" },
|
| 262 |
+
{ word: "ONKEL", hint: "Der Bruder deiner Mutter oder deines Vaters" },
|
| 263 |
+
{ word: "COUSIN", hint: "Der Sohn deiner Tante oder deines Onkels" },
|
| 264 |
+
{ word: "COUSINE", hint: "Die Tochter deiner Tante oder deines Onkels" }
|
| 265 |
+
]
|
| 266 |
+
},
|
| 267 |
+
natur: {
|
| 268 |
+
name: "Natur",
|
| 269 |
+
words: [
|
| 270 |
+
{ word: "BAUM", hint: "Große Pflanze mit Stamm und Blättern" },
|
| 271 |
+
{ word: "BLUME", hint: "Schöne Pflanze mit bunten Blüten" },
|
| 272 |
+
{ word: "GRAS", hint: "Grüne Pflanze, die auf Wiesen wächst" },
|
| 273 |
+
{ word: "SONNE", hint: "Großer, heißer Stern am Himmel" },
|
| 274 |
+
{ word: "WOLKE", hint: "Weiß und flauschig am Himmel" },
|
| 275 |
+
{ word: "REGEN", hint: "Wasser, das vom Himmel fällt" },
|
| 276 |
+
{ word: "SCHNEE", hint: "Weiß, kalt und fällt im Winter" },
|
| 277 |
+
{ word: "BERG", hint: "Sehr hoch und man kann ihn besteigen" },
|
| 278 |
+
{ word: "FLUSS", hint: "Langes, fließendes Gewässer" },
|
| 279 |
+
{ word: "MEER", hint: "Sehr großes Salzwasser" }
|
| 280 |
]
|
| 281 |
}
|
| 282 |
};
|
|
|
|
| 289 |
let hintUsed = false;
|
| 290 |
let currentCategory = "";
|
| 291 |
let gameActive = true;
|
| 292 |
+
let gameHistory = JSON.parse(localStorage.getItem('norasGameHistory')) || [];
|
| 293 |
+
let wins = 0;
|
| 294 |
+
let losses = 0;
|
| 295 |
|
| 296 |
// DOM elements
|
| 297 |
const wordDisplay = document.getElementById('word-display');
|
|
|
|
| 304 |
const hintArea = document.getElementById('hint-area');
|
| 305 |
const hintText = document.getElementById('hint-text');
|
| 306 |
const categoryDisplay = document.getElementById('category');
|
| 307 |
+
const gameHistorySection = document.getElementById('game-history');
|
| 308 |
+
const historyTable = document.getElementById('history-table');
|
| 309 |
+
const winsDisplay = document.getElementById('wins');
|
| 310 |
+
const lossesDisplay = document.getElementById('losses');
|
| 311 |
+
const toggleHistoryButton = document.getElementById('toggle-history');
|
| 312 |
const hangmanParts = [
|
| 313 |
'head', 'body', 'left-arm', 'right-arm',
|
| 314 |
+
'left-leg', 'right-leg'
|
| 315 |
];
|
| 316 |
+
const face = document.getElementById('face');
|
| 317 |
+
const correctSound = document.getElementById('correct-sound');
|
| 318 |
+
const wrongSound = document.getElementById('wrong-sound');
|
| 319 |
+
const winSound = document.getElementById('win-sound');
|
| 320 |
+
const loseSound = document.getElementById('lose-sound');
|
| 321 |
|
| 322 |
// Initialize the game
|
| 323 |
function initGame() {
|
|
|
|
| 333 |
message.classList.add('hidden');
|
| 334 |
newGameButton.classList.add('hidden');
|
| 335 |
hintArea.classList.add('hidden');
|
| 336 |
+
hintButton.classList.remove('hidden');
|
| 337 |
|
| 338 |
// Reset hangman
|
| 339 |
hangmanParts.forEach(part => {
|
| 340 |
document.getElementById(part).classList.remove('visible');
|
| 341 |
});
|
| 342 |
|
| 343 |
+
// Reset face
|
| 344 |
+
face.classList.remove('sad-face');
|
| 345 |
+
face.classList.add('happy-face');
|
| 346 |
+
|
| 347 |
// Select a random category
|
| 348 |
const categories = Object.keys(wordCategories);
|
| 349 |
currentCategory = categories[Math.floor(Math.random() * categories.length)];
|
|
|
|
| 359 |
updateMistakesDisplay();
|
| 360 |
createWordDisplay();
|
| 361 |
createKeyboard();
|
| 362 |
+
|
| 363 |
+
// Update game history display
|
| 364 |
+
updateGameHistory();
|
| 365 |
}
|
| 366 |
|
| 367 |
// Create the word display with blanks
|
|
|
|
| 419 |
button.classList.add('bounce');
|
| 420 |
setTimeout(() => button.classList.remove('bounce'), 500);
|
| 421 |
|
| 422 |
+
// Play correct sound
|
| 423 |
+
correctSound.currentTime = 0;
|
| 424 |
+
correctSound.play();
|
| 425 |
+
|
| 426 |
createWordDisplay();
|
| 427 |
checkWin();
|
| 428 |
} else {
|
|
|
|
| 432 |
button.classList.add('bounce');
|
| 433 |
setTimeout(() => button.classList.remove('bounce'), 500);
|
| 434 |
|
| 435 |
+
// Play wrong sound
|
| 436 |
+
wrongSound.currentTime = 0;
|
| 437 |
+
wrongSound.play();
|
| 438 |
+
|
| 439 |
mistakes++;
|
| 440 |
updateMistakesDisplay();
|
| 441 |
showHangmanPart();
|
|
|
|
| 448 |
if (mistakes <= hangmanParts.length) {
|
| 449 |
const part = hangmanParts[mistakes - 1];
|
| 450 |
document.getElementById(part).classList.add('visible');
|
| 451 |
+
|
| 452 |
+
// Make face sad when mistakes reach half
|
| 453 |
+
if (mistakes >= maxMistakes / 2) {
|
| 454 |
+
face.classList.remove('happy-face');
|
| 455 |
+
face.classList.add('sad-face');
|
| 456 |
+
}
|
| 457 |
}
|
| 458 |
}
|
| 459 |
|
|
|
|
| 484 |
message.classList.remove('hidden');
|
| 485 |
message.classList.add('bg-green-100', 'text-green-800');
|
| 486 |
newGameButton.classList.remove('hidden');
|
| 487 |
+
|
| 488 |
+
// Play win sound
|
| 489 |
+
winSound.currentTime = 0;
|
| 490 |
+
winSound.play();
|
| 491 |
+
|
| 492 |
+
// Add to game history
|
| 493 |
+
addToGameHistory(true);
|
| 494 |
createConfetti();
|
| 495 |
}
|
| 496 |
}
|
|
|
|
| 504 |
message.classList.add('bg-red-100', 'text-red-800');
|
| 505 |
newGameButton.classList.remove('hidden');
|
| 506 |
|
| 507 |
+
// Play lose sound
|
| 508 |
+
loseSound.currentTime = 0;
|
| 509 |
+
loseSound.play();
|
| 510 |
+
|
| 511 |
+
// Add to game history
|
| 512 |
+
addToGameHistory(false);
|
| 513 |
+
|
| 514 |
// Reveal the word
|
| 515 |
revealWord();
|
| 516 |
}
|
|
|
|
| 535 |
}
|
| 536 |
}
|
| 537 |
|
| 538 |
+
// Add game result to history
|
| 539 |
+
function addToGameHistory(won) {
|
| 540 |
+
const gameResult = {
|
| 541 |
+
date: new Date().toLocaleString(),
|
| 542 |
+
word: currentWord,
|
| 543 |
+
result: won ? 'Gewonnen' : 'Verloren',
|
| 544 |
+
mistakes: mistakes,
|
| 545 |
+
won: won
|
| 546 |
+
};
|
| 547 |
+
|
| 548 |
+
gameHistory.unshift(gameResult);
|
| 549 |
+
|
| 550 |
+
// Keep only last 20 games
|
| 551 |
+
if (gameHistory.length > 20) {
|
| 552 |
+
gameHistory = gameHistory.slice(0, 20);
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
// Save to localStorage
|
| 556 |
+
localStorage.setItem('norasGameHistory', JSON.stringify(gameHistory));
|
| 557 |
+
|
| 558 |
+
// Update stats
|
| 559 |
+
updateStats();
|
| 560 |
+
}
|
| 561 |
+
|
| 562 |
+
// Update game history display
|
| 563 |
+
function updateGameHistory() {
|
| 564 |
+
if (gameHistory.length > 0) {
|
| 565 |
+
gameHistorySection.classList.remove('hidden');
|
| 566 |
+
historyTable.innerHTML = '';
|
| 567 |
+
|
| 568 |
+
gameHistory.forEach(game => {
|
| 569 |
+
const row = document.createElement('tr');
|
| 570 |
+
row.className = 'border-b border-gray-200 hover:bg-gray-50';
|
| 571 |
+
|
| 572 |
+
row.innerHTML = `
|
| 573 |
+
<td class="px-4 py-2">${game.date}</td>
|
| 574 |
+
<td class="px-4 py-2">${game.word}</td>
|
| 575 |
+
<td class="px-4 py-2 ${game.won ? 'text-green-600' : 'text-red-600'}">${game.result}</td>
|
| 576 |
+
<td class="px-4 py-2">${game.mistakes}</td>
|
| 577 |
+
`;
|
| 578 |
+
|
| 579 |
+
historyTable.appendChild(row);
|
| 580 |
+
});
|
| 581 |
+
} else {
|
| 582 |
+
gameHistorySection.classList.add('hidden');
|
| 583 |
+
}
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
// Update win/loss stats
|
| 587 |
+
function updateStats() {
|
| 588 |
+
wins = gameHistory.filter(game => game.won).length;
|
| 589 |
+
losses = gameHistory.filter(game => !game.won).length;
|
| 590 |
+
|
| 591 |
+
winsDisplay.textContent = wins;
|
| 592 |
+
lossesDisplay.textContent = losses;
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
// Show hint
|
| 596 |
hintButton.addEventListener('click', function() {
|
| 597 |
if (!hintUsed && gameActive) {
|
|
|
|
| 604 |
// New game button
|
| 605 |
newGameButton.addEventListener('click', initGame);
|
| 606 |
|
| 607 |
+
// Toggle game history visibility
|
| 608 |
+
toggleHistoryButton.addEventListener('click', function() {
|
| 609 |
+
if (gameHistorySection.classList.contains('hidden')) {
|
| 610 |
+
gameHistorySection.classList.remove('hidden');
|
| 611 |
+
toggleHistoryButton.innerHTML = '<i class="fas fa-eye-slash mr-2"></i>Verstecken';
|
| 612 |
+
} else {
|
| 613 |
+
gameHistorySection.classList.add('hidden');
|
| 614 |
+
toggleHistoryButton.innerHTML = '<i class="fas fa-eye mr-2"></i>Anzeigen';
|
| 615 |
+
}
|
| 616 |
+
});
|
| 617 |
+
|
| 618 |
// Create confetti effect
|
| 619 |
function createConfetti() {
|
| 620 |
const colors = ['#f00', '#0f0', '#00f', '#ff0', '#f0f', '#0ff'];
|
|
|
|
| 646 |
|
| 647 |
// Start the game
|
| 648 |
initGame();
|
| 649 |
+
updateStats();
|
| 650 |
});
|
| 651 |
</script>
|
| 652 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ThetaPhiPsi/noras-hangman" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|