From b5136a68e4373d73ee8fadff2b80bdf71e67c251 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Tue, 4 Aug 2026 11:59:23 +0530 Subject: [PATCH] fix: resolve 4 bugs in GameHub --- frontend/public/games/Flappy Block/script.js | 2 +- frontend/public/games/Sliding Puzzle/script.js | 2 +- frontend/public/games/flappyBird/flappy.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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/Sliding Puzzle/script.js b/frontend/public/games/Sliding Puzzle/script.js index 26baff6c..f7450b7a 100644 --- a/frontend/public/games/Sliding Puzzle/script.js +++ b/frontend/public/games/Sliding Puzzle/script.js @@ -12,7 +12,7 @@ function createPuzzle() { } function render() { - puzzle.innerHTML = ""; + puzzle.textContent = ""; tiles.forEach((num, i) => { let tile = document.createElement("div"); tile.classList.add("tile"); diff --git a/frontend/public/games/flappyBird/flappy.js b/frontend/public/games/flappyBird/flappy.js index e6dbae00..689b263f 100644 --- a/frontend/public/games/flappyBird/flappy.js +++ b/frontend/public/games/flappyBird/flappy.js @@ -52,7 +52,7 @@ bottomPipeImg= new Image(); bottomPipeImg.src="bottompipe.png"; requestAnimationFrame(update); -setInterval(placePipes, 1500); //1.5 sec +clearInterval(window.__interval); window.__interval = setInterval(placePipes, 1500); //1.5 sec document.addEventListener("keydown",moveBird); }; context.drawImage(birdImg, bird.x, bird.y, bird.width, bird.height);