let buttonSelectScore = 0; let searchName = ''; let scorescreenOn = false; function scoremenu() { textSize(50) fill(255, 255, 255) text("Hi, dit is een scorescreen", width / 2, height / 2 - 100) } function keyPressed() { // Check if the back button was selected and the Enter key was pressed if (keyCode == ENTER && buttonSelectScore == 0) { scorescreenOn = false; } } function homescreen() { textAlign(CENTER); button(255, 255, 255, width / 2, height / 2, 200, 40, "Start Game") button(255, 255, 255, width / 2, height / 2 + 50, 200, 40, "Scores") push() stroke(255, 255, 255) strokeWeight(5) fill(0, 255, 0, 0) rect(width/4*3, height/2, 300, 400) pop() //highscores rectangle push() textSize(50) fill(255, 255, 255) text("Highscores", width/4, 200) pop() push() fill(255, 255, 255) textSize(25) textAlign(CENTER) for (let i = 0; i < requesteddata.length; i++) { text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score, width/4, 250 + (i * 30)) } pop() push() stroke(255, 255, 255) strokeWeight(5) fill(0, 255, 0, 0) rect(width/4, height/2, 300, 400) pop() push() textSize(50) fill(255, 255, 255) text("Controls", width/4*3, 200) pop() } function button(r, g, b, buttonX, buttonY, buttonWidth, buttonHeight, buttonText) { push() fill(0, 0, 50) rectMode(CENTER); rect(buttonX, buttonY, buttonWidth, buttonHeight) textSize(25) fill(r, g, b) textAlign(CENTER); text(buttonText, buttonX, buttonY + buttonHeight/4) pop() } function pauseMenu(){ textAlign(CENTER); textSize(50); fill(255, 255, 255); text("Paused", width / 2, height / 2 - 100); button(255, 255, 255, width / 2, height / 2, 200, 40, "Resume"); button(255, 255, 255, width / 2, height / 2 + 50, 200, 40, "Main Menu"); }