added gameover screen to menu.js and stopped drawing player and boss when paused

This commit is contained in:
Mees Roelofsz
2024-01-19 10:17:22 +01:00
parent f5f9efc137
commit dd5c48926b
2 changed files with 50 additions and 44 deletions

View File

@@ -81,7 +81,6 @@ function scoremenu() {
clearDataOnce = true;
}
if (scorescreenOn && keyReleasedFlag) {
nameSubmit();
}
@@ -101,7 +100,7 @@ function scoremenu() {
else {
nameDraw(3);
}
push()
fill(255, 255, 255)
textSize(25)
@@ -134,4 +133,33 @@ function scoremenu() {
text("Your scores", width / 4, height / 6)
text("Your achievements", width / 4 * 3, height / 6)
pop()
}
function gameOver() {
if (lives <= 0) {
//game over screen
iIndex = constrain(iIndex, 0, 2);
isDead = true;
push();
fill(255, 0, 0);
textSize(60);
textAlign(CENTER, CENTER);
text("Game Over", width / 2, height / 2 - height / 5);
fill(255, 255, 255)
textSize(18);
text("Score: " + int(time), width / 2, height / 2 - height / 8);
textSize(32);
textAlign(CENTER, CENTER);
text(letters[currentIndex[0]], width / 2 - 30, height / 2);
text(letters[currentIndex[1]], width / 2, height / 2);
text(letters[currentIndex[2]], width / 2 + 30, height / 2);
text("Restart", width / 2, height / 2 + height / 12);
text("Main Menu", width / 2, height / 2 + height / 6);
pop();
}
}