added all pause screen stops to the same if statement
This commit is contained in:
29
web/game.js
29
web/game.js
@@ -576,6 +576,19 @@ function game() {
|
|||||||
bossPosX = width / 2;
|
bossPosX = width / 2;
|
||||||
bossPosY = height / 6;
|
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();
|
pop();
|
||||||
if (hasMoved == true) {
|
if (hasMoved == true) {
|
||||||
@@ -621,26 +634,10 @@ function game() {
|
|||||||
circle(x4, y4, 50);
|
circle(x4, y4, 50);
|
||||||
circle(x5, y5, 50);
|
circle(x5, y5, 50);
|
||||||
pop();
|
pop();
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
x2 = width / 2;
|
x2 = width / 2;
|
||||||
y2 = 100;
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user