From cd34a1bf90e688ee7ab53d0d1c5c8ddb8067c4dc Mon Sep 17 00:00:00 2001 From: Mees Roelofsz Date: Fri, 19 Jan 2024 10:30:20 +0100 Subject: [PATCH] added all pause screen stops to the same if statement --- web/game.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/web/game.js b/web/game.js index a49a542..3cc2948 100644 --- a/web/game.js +++ b/web/game.js @@ -576,6 +576,19 @@ function game() { bossPosX = width / 2; bossPosY = height / 6; } + + bullets.forEach(myBullet => { + //zolang mybullet bestaat blijft hij drawen en updaten + ({ hit, shot, isOffScreen, originalPos } = myBullet.update(playerPosX, playerPosY, hasMoved, radius)); + myBullet.draw(); + + if (isOffScreen == true) { + myBullet.hit = true; + shot = false; + } + }); + //blijf de bullet tekenen zolang hit false is + bullets = bullets.filter(bullet => !bullet.hit); } pop(); if (hasMoved == true) { @@ -621,26 +634,10 @@ function game() { circle(x4, y4, 50); circle(x5, y5, 50); pop(); - - } else { x2 = width / 2; y2 = 100; } - if (!pausescreenOn) { - bullets.forEach(myBullet => { - //zolang mybullet bestaat blijft hij drawen en updaten - ({ hit, shot, isOffScreen, originalPos } = myBullet.update(playerPosX, playerPosY, hasMoved, radius)); - myBullet.draw(); - - if (isOffScreen == true) { - myBullet.hit = true; - shot = false; - } - }); - //blijf de bullet tekenen zolang hit false is - bullets = bullets.filter(bullet => !bullet.hit); - } } } \ No newline at end of file