added score

This commit is contained in:
Mees Roelofsz
2024-01-06 14:56:40 +01:00
parent 58da9e9bc4
commit 14f2fe6e76

View File

@@ -95,8 +95,11 @@ function gameOver() {
text("Game Over", width / 2, height / 2 - 80); text("Game Over", width / 2, height / 2 - 80);
fill(255, 255, 255) fill(255, 255, 255)
textSize(32); textSize(18);
textAlign(CENTER); textAlign(CENTER);
text("Score: " + int(time), width / 2, height / 2 - 55);
textSize(32);
text(letters[currentIndex[0]], width / 2 - 30, height / 2); text(letters[currentIndex[0]], width / 2 - 30, height / 2);
text(letters[currentIndex[1]], width / 2, height / 2); text(letters[currentIndex[1]], width / 2, height / 2);
text(letters[currentIndex[2]], width / 2 + 30, height / 2); text(letters[currentIndex[2]], width / 2 + 30, height / 2);
@@ -185,6 +188,7 @@ async function keyPressed() {
finalPhase = false; finalPhase = false;
isDead = false; isDead = false;
entered = false; entered = false;
buttonSelect = 0;
} }
} }
if (buttonSelect == 2) { if (buttonSelect == 2) {
@@ -204,6 +208,7 @@ async function keyPressed() {
finalPhase = false; finalPhase = false;
isDead = false; isDead = false;
entered = false; entered = false;
buttonSelect = 0;
} }
} }
} }
@@ -245,7 +250,6 @@ async function Movementloop() {
function draw() { function draw() {
keyPressed(); keyPressed();
gameOver(); gameOver();
phase();
// draw background // draw background
background(0, 0, 0, 100); background(0, 0, 0, 100);
@@ -253,6 +257,7 @@ function draw() {
homescreen(); homescreen();
} }
if (homescreenOn == false) { if (homescreenOn == false) {
phase();
game(); game();
} }
if (isDead == true) { if (isDead == true) {