added all pause screen stops to the same if statement

This commit is contained in:
Mees Roelofsz
2024-01-19 10:30:20 +01:00
parent 16e27c5e79
commit cd34a1bf90

View File

@@ -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);
}
}
}