From 3bf339f0ec3f83d9c23ec922ef99b3f813c56d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Tue, 25 Nov 2025 21:34:54 +0100 Subject: [PATCH] bug fixes --- static/js/render.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/static/js/render.js b/static/js/render.js index 7b1f2aa..5c3766a 100644 --- a/static/js/render.js +++ b/static/js/render.js @@ -53,7 +53,7 @@ function drawGame() { // Haben wir Hintergründe geladen? if (bgSprites.length > 0) { // Wechsel alle 2000 Punkte (Server-Score) = 200 Punkte (Anzeige) - const changeInterval = 2000; + const changeInterval = 10000; // Berechne Index: 0-1999 -> 0, 2000-3999 -> 1, etc. // Das % (Modulo) sorgt dafür, dass es wieder von vorne anfängt, wenn die Bilder ausgehen @@ -62,9 +62,8 @@ function drawGame() { currentBg = bgSprites[bgIndex]; } - // Zeichnen (wenn Bild geladen und nicht kaputt) + if (currentBg && currentBg.complete && currentBg.naturalHeight !== 0) { - // Streckt das Bild exakt auf die Spielgröße (800x400) ctx.drawImage(currentBg, 0, 0, GAME_WIDTH, GAME_HEIGHT); } else { // Fallback: Hellgrau, falls Bild fehlt