Initial commit - Kinderspiele
This commit is contained in:
@@ -0,0 +1,188 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<title>Tierlaute - KinderWelt</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }
|
||||
body {
|
||||
background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
|
||||
min-height: 100vh; display: flex; flex-direction: column; align-items: center;
|
||||
font-family: 'Comic Sans MS', cursive, sans-serif; padding: 20px;
|
||||
}
|
||||
h1 { color: white; margin-bottom: 15px; font-size: 28px; }
|
||||
.question { color: white; font-size: 22px; margin: 20px 0; text-align: center; }
|
||||
.sound-btn {
|
||||
background: linear-gradient(135deg, #fbbf24, #f59e0b); border: none; border-radius: 50%;
|
||||
width: 120px; height: 120px; font-size: 60px; cursor: pointer;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.3); margin: 20px 0;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
.sound-btn:hover { transform: scale(1.1); }
|
||||
.sound-btn:active { transform: scale(0.9); }
|
||||
.animals-grid {
|
||||
display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px;
|
||||
max-width: 400px; width: 100%; margin: 20px 0;
|
||||
}
|
||||
.animal-card {
|
||||
background: white; border-radius: 20px; padding: 20px;
|
||||
display: flex; flex-direction: column; align-items: center;
|
||||
cursor: pointer; transition: all 0.2s; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
||||
}
|
||||
.animal-card:hover { transform: translateY(-5px); }
|
||||
.animal-card:active { transform: scale(0.95); }
|
||||
.animal-card.correct { background: #86efac; }
|
||||
.animal-card.wrong { background: #fca5a5; }
|
||||
.animal-emoji { font-size: 50px; margin-bottom: 5px; }
|
||||
.animal-name { font-size: 18px; color: #333; font-weight: bold; }
|
||||
.score { color: white; font-size: 20px; margin: 10px 0; }
|
||||
.feedback { font-size: 36px; margin: 10px 0; min-height: 50px; }
|
||||
.controls { display: flex; gap: 15px; margin-top: 20px; }
|
||||
.btn {
|
||||
background: white; border: none; border-radius: 10px; padding: 12px 25px;
|
||||
font-size: 16px; cursor: pointer; font-family: inherit; font-weight: bold;
|
||||
}
|
||||
.btn-back { background: #ff6b6b; color: white; text-decoration: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>🦁 Tierlaute</h1>
|
||||
|
||||
<div class="score">Richtig: <span id="correct">0</span> | Versuche: <span id="total">0</span></div>
|
||||
|
||||
<div class="question">Welches Tier macht dieses Geräusch?</div>
|
||||
|
||||
<button class="sound-btn" onclick="playCurrentSound()">🔊</button>
|
||||
|
||||
<div class="feedback" id="feedback"></div>
|
||||
|
||||
<div class="animals-grid" id="animalsGrid"></div>
|
||||
|
||||
<div class="controls">
|
||||
<button class="btn" onclick="nextQuestion()">🔄 Nächstes Tier</button>
|
||||
<a href="../index.html" class="btn btn-back">⬅️ Zurück</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const animals = [
|
||||
{ emoji: '🐶', name: 'Hund', sound: 'Wau wau!' },
|
||||
{ emoji: '🐱', name: 'Katze', sound: 'Miau!' },
|
||||
{ emoji: '🐮', name: 'Kuh', sound: 'Muh!' },
|
||||
{ emoji: '🐷', name: 'Schwein', sound: 'Oink oink!' },
|
||||
{ emoji: '🐔', name: 'Huhn', sound: 'Gack gack!' },
|
||||
{ emoji: '🐴', name: 'Pferd', sound: 'Wieher!' },
|
||||
{ emoji: '🐸', name: 'Frosch', sound: 'Quak quak!' },
|
||||
{ emoji: '🦆', name: 'Ente', sound: 'Quack quack!' },
|
||||
{ emoji: '🐘', name: 'Elefant', sound: 'Törööö!' },
|
||||
{ emoji: '🦁', name: 'Löwe', sound: 'Roooar!' },
|
||||
{ emoji: '🐍', name: 'Schlange', sound: 'Zisch!' },
|
||||
{ emoji: '🦉', name: 'Eule', sound: 'Huhuhu!' }
|
||||
];
|
||||
|
||||
let currentAnimal = null;
|
||||
let correctCount = 0;
|
||||
let totalCount = 0;
|
||||
let answered = false;
|
||||
const synth = window.speechSynthesis;
|
||||
|
||||
function initGame() {
|
||||
nextQuestion();
|
||||
}
|
||||
|
||||
function nextQuestion() {
|
||||
answered = false;
|
||||
document.getElementById('feedback').textContent = '';
|
||||
|
||||
// Zufälliges Tier
|
||||
currentAnimal = animals[Math.floor(Math.random() * animals.length)];
|
||||
|
||||
// 4 Optionen (inkl. richtige)
|
||||
let options = [currentAnimal];
|
||||
while (options.length < 4) {
|
||||
const random = animals[Math.floor(Math.random() * animals.length)];
|
||||
if (!options.find(o => o.name === random.name)) {
|
||||
options.push(random);
|
||||
}
|
||||
}
|
||||
|
||||
// Mischen
|
||||
options.sort(() => Math.random() - 0.5);
|
||||
|
||||
// Grid bauen
|
||||
const grid = document.getElementById('animalsGrid');
|
||||
grid.innerHTML = '';
|
||||
|
||||
options.forEach(animal => {
|
||||
const card = document.createElement('div');
|
||||
card.className = 'animal-card';
|
||||
card.innerHTML = `
|
||||
<div class="animal-emoji">${animal.emoji}</div>
|
||||
<div class="animal-name">${animal.name}</div>
|
||||
`;
|
||||
card.onclick = () => checkAnswer(animal, card);
|
||||
grid.appendChild(card);
|
||||
});
|
||||
|
||||
// Auto-play nach kurzer Zeit
|
||||
setTimeout(playCurrentSound, 500);
|
||||
}
|
||||
|
||||
function playCurrentSound() {
|
||||
if (!currentAnimal) return;
|
||||
|
||||
// TTS für Tier-Sound
|
||||
const utterance = new SpeechSynthesisUtterance(currentAnimal.sound);
|
||||
utterance.lang = 'de-DE';
|
||||
utterance.rate = 0.8;
|
||||
utterance.pitch = 1.2;
|
||||
synth.speak(utterance);
|
||||
}
|
||||
|
||||
function checkAnswer(selected, cardElement) {
|
||||
if (answered) return;
|
||||
answered = true;
|
||||
|
||||
totalCount++;
|
||||
document.getElementById('total').textContent = totalCount;
|
||||
|
||||
if (selected.name === currentAnimal.name) {
|
||||
correctCount++;
|
||||
document.getElementById('correct').textContent = correctCount;
|
||||
cardElement.classList.add('correct');
|
||||
document.getElementById('feedback').textContent = '🎉 Richtig!';
|
||||
|
||||
const utterance = new SpeechSynthesisUtterance('Richtig! ' + currentAnimal.sound);
|
||||
utterance.lang = 'de-DE';
|
||||
utterance.rate = 0.8;
|
||||
synth.speak(utterance);
|
||||
|
||||
setTimeout(nextQuestion, 2000);
|
||||
} else {
|
||||
cardElement.classList.add('wrong');
|
||||
document.getElementById('feedback').textContent = '❌ Das ist ' + selected.name;
|
||||
|
||||
// Richtige hervorheben
|
||||
const cards = document.querySelectorAll('.animal-card');
|
||||
cards.forEach(card => {
|
||||
if (card.textContent.includes(currentAnimal.name)) {
|
||||
card.classList.add('correct');
|
||||
}
|
||||
});
|
||||
|
||||
const utterance = new SpeechSynthesisUtterance('Das ist ' + selected.name + '. Höre nochmal!');
|
||||
utterance.lang = 'de-DE';
|
||||
synth.speak(utterance);
|
||||
|
||||
setTimeout(() => {
|
||||
answered = false;
|
||||
playCurrentSound();
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
// Init
|
||||
initGame();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user