From a0e82477bca3e5ee040477a352f41874947fcac8 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Tue, 4 Aug 2026 12:57:00 +0530 Subject: [PATCH] fix: resolve 4 bugs in GameHub --- frontend/public/games/Dodge Square/script.js | 2 +- frontend/public/games/Flappy Block/script.js | 2 +- frontend/public/games/jump-tag/script.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/public/games/Dodge Square/script.js b/frontend/public/games/Dodge Square/script.js index 51ce4b39..a1d46e74 100644 --- a/frontend/public/games/Dodge Square/script.js +++ b/frontend/public/games/Dodge Square/script.js @@ -90,6 +90,6 @@ document.addEventListener("keydown", e => { document.getElementById("startBtn").addEventListener("click", () => { resetGame(); - setInterval(update, 20); + clearInterval(window.__interval); window.__interval = setInterval(update, 20); draw(); }); diff --git a/frontend/public/games/Flappy Block/script.js b/frontend/public/games/Flappy Block/script.js index af98699f..ff18492c 100644 --- a/frontend/public/games/Flappy Block/script.js +++ b/frontend/public/games/Flappy Block/script.js @@ -54,7 +54,7 @@ function update() { pipes.splice(i, 1); createPipe(); score++; - document.getElementById("score").innerText = `Score: ${score}`; + document.getElementById("score").textContent = `Score: ${score}`; } if (block.x < pipe.x + pipe.width && diff --git a/frontend/public/games/jump-tag/script.js b/frontend/public/games/jump-tag/script.js index c2d520ba..91d8e99f 100644 --- a/frontend/public/games/jump-tag/script.js +++ b/frontend/public/games/jump-tag/script.js @@ -106,7 +106,7 @@ if (player.onGround && player.state === 'alive') { player.vy = -720; player.onGround = false; - if (!muted) audioJump.currentTime = 0, audioJump.play().catch(()=>{}); + if (!muted) audioJump.currentTime = 0, audioJump.play().catch( => console.error()); } }