From fe23cf3faab6783d9c7b4f7875d9a6178af4d20a Mon Sep 17 00:00:00 2001 From: Marlon Nunez Date: Tue, 21 Apr 2026 22:03:57 -0500 Subject: [PATCH] Issue #5223 Fixed: Functional Start New Game Button --- Games/Tetris/script.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Games/Tetris/script.js b/Games/Tetris/script.js index 3445b2974f..42a97c80db 100644 --- a/Games/Tetris/script.js +++ b/Games/Tetris/script.js @@ -1,6 +1,8 @@ let canvas = document.querySelector("#tetris"); let scoreboard = document.querySelector("h2"); let ctx = canvas.getContext("2d"); +let newgamebutton = document.getElementById("start-button"); + ctx.scale(30,30); const SHAPES = [ @@ -60,6 +62,12 @@ let fallingPieceObj = null; let score = 0; setInterval(newGameState,500); + +newgamebutton.addEventListener("click", () => { + grid = generateGrid(); + score = 0; + fallingPieceObj = null; +}) function newGameState(){ checkGrid(); if(!fallingPieceObj){