Fix: Initialisierung korrigiert

This commit is contained in:
2026-04-18 18:47:35 +02:00
parent 27a28ce76e
commit 288d5f5734

View File

@@ -142,19 +142,12 @@
// Initialisierung // Initialisierung
function initGame() { function initGame() {
rivers.length = 0; // Logs (Baumstämme im Wasser)
for (let i = 0; i < numRivers; i++) { logs.length = 0;
rivers.push({
y: canvas.height - 150 - (i * 60),
width: 40 + Math.random() * 30,
speed: 1 + Math.random() * 1.5,
direction: i % 2 === 0 ? 1 : -1,
items: []
});
for (let i = 0; i < numLogs; i++) { for (let i = 0; i < numLogs; i++) {
logs.push({ logs.push({
y: canvas.height - 150 - (i * 60), y: canvas.height - 150 - (i * 60),
x: Math.random() * (canvas.width - 100),
width: 80 + Math.random() * 60, width: 80 + Math.random() * 60,
speed: 1 + Math.random() * 1.5, speed: 1 + Math.random() * 1.5,
direction: i % 2 === 0 ? 1 : -1 direction: i % 2 === 0 ? 1 : -1
@@ -172,11 +165,12 @@
}); });
} }
// Aligatoren (Gegner)
alligators.length = 0; alligators.length = 0;
for (let i = 0; i < numAlligators; i++) { for (let i = 0; i < numAlligators; i++) {
alligators.push({ alligators.push({
x: Math.random() * canvas.width, x: Math.random() * canvas.width,
y: 200 + Math.random() * 200, y: 150 + Math.random() * 250,
width: 60, width: 60,
height: 30, height: 30,
speed: 1.5 + Math.random(), speed: 1.5 + Math.random(),