added scoremenu and used name functions
This commit is contained in:
@@ -1,12 +1,6 @@
|
|||||||
let buttonSelectScore = 0;
|
let buttonSelectScore = 0;
|
||||||
let searchName = '';
|
let searchName = '';
|
||||||
let scorescreenOn = false;
|
let scorescreenOn = false;
|
||||||
function scoremenu() {
|
|
||||||
|
|
||||||
textSize(50)
|
|
||||||
fill(255, 255, 255)
|
|
||||||
text("Hi, dit is een scorescreen", width / 2, height / 2 - 100)
|
|
||||||
}
|
|
||||||
|
|
||||||
function keyPressed() {
|
function keyPressed() {
|
||||||
// Check if the back button was selected and the Enter key was pressed
|
// Check if the back button was selected and the Enter key was pressed
|
||||||
@@ -18,19 +12,19 @@ function keyPressed() {
|
|||||||
function homescreen() {
|
function homescreen() {
|
||||||
textAlign(CENTER);
|
textAlign(CENTER);
|
||||||
button(255, 255, 255, width / 2, height / 2, "Start Game")
|
button(255, 255, 255, width / 2, height / 2, "Start Game")
|
||||||
button(255, 255, 255, width / 2, height / 2 + height/12, "Scores")
|
button(255, 255, 255, width / 2, height / 2 + height / 12, "Scores")
|
||||||
|
|
||||||
push()
|
push()
|
||||||
stroke(4,217,255)
|
stroke(4, 217, 255)
|
||||||
strokeWeight(5)
|
strokeWeight(5)
|
||||||
fill(0, 255, 0, 0)
|
fill(0, 255, 0, 0)
|
||||||
rect(width/5*4, height/2, width/4, height/1.5)
|
rect(width / 5 * 4, height / 2, width / 4, height / 1.5)
|
||||||
pop()
|
pop()
|
||||||
//highscores rectangle
|
//highscores rectangle
|
||||||
push()
|
push()
|
||||||
textSize(50)
|
textSize(50)
|
||||||
fill(255, 255, 255)
|
fill(255, 255, 255)
|
||||||
text("Highscores", width/5, height/4)
|
text("Highscores", width / 5, height / 4)
|
||||||
pop()
|
pop()
|
||||||
|
|
||||||
push()
|
push()
|
||||||
@@ -38,21 +32,21 @@ function homescreen() {
|
|||||||
textSize(25)
|
textSize(25)
|
||||||
textAlign(CENTER, CENTER)
|
textAlign(CENTER, CENTER)
|
||||||
for (let i = 0; i < requesteddata.length; i++) {
|
for (let i = 0; i < requesteddata.length; i++) {
|
||||||
text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score, width/5, height/3 + (i * 30))
|
text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score, width / 5, height / 3 + (i * 30))
|
||||||
}
|
}
|
||||||
pop()
|
pop()
|
||||||
|
|
||||||
push()
|
push()
|
||||||
stroke(4,217,255)
|
stroke(4, 217, 255)
|
||||||
strokeWeight(5)
|
strokeWeight(5)
|
||||||
fill(0, 255, 0, 0)
|
fill(0, 255, 0, 0)
|
||||||
rect(width/5, height/2, width/4, height/1.5)
|
rect(width / 5, height / 2, width / 4, height / 1.5)
|
||||||
pop()
|
pop()
|
||||||
|
|
||||||
push()
|
push()
|
||||||
textSize(50)
|
textSize(50)
|
||||||
fill(255, 255, 255)
|
fill(255, 255, 255)
|
||||||
text("Controls", width/5*4, height/4)
|
text("Controls", width / 5 * 4, height / 4)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,16 +58,32 @@ function button(r, g, b, buttonX, buttonY, buttonText) {
|
|||||||
textSize(25)
|
textSize(25)
|
||||||
fill(r, g, b)
|
fill(r, g, b)
|
||||||
textAlign(CENTER);
|
textAlign(CENTER);
|
||||||
text(buttonText, buttonX, buttonY + buttonHeight/4)
|
text(buttonText, buttonX, buttonY + buttonHeight / 4)
|
||||||
|
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
function pauseMenu(){
|
function pauseMenu() {
|
||||||
textAlign(CENTER);
|
textAlign(CENTER);
|
||||||
textSize(50);
|
textSize(50);
|
||||||
fill(255, 255, 255);
|
fill(255, 255, 255);
|
||||||
text("Paused", width / 2, height / 2 - height/6);
|
text("Paused", width / 2, height / 2 - height / 6);
|
||||||
button(255, 255, 255, width / 2, height / 2, "Resume");
|
button(255, 255, 255, width / 2, height / 2, "Resume");
|
||||||
button(255, 255, 255, width / 2, height / 2 + height/12, "Main Menu");
|
button(255, 255, 255, width / 2, height / 2 + height / 12, "Main Menu");
|
||||||
|
}
|
||||||
|
|
||||||
|
function scoremenu() {
|
||||||
|
textAlign(CENTER);
|
||||||
|
textSize(50);
|
||||||
|
fill(255, 255, 255);
|
||||||
|
text("Score", width / 2, height / 2 - height / 6);
|
||||||
|
textSize(32);
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (scorescreenOn && keyReleasedFlag) {
|
||||||
|
nameSubmit();
|
||||||
|
}
|
||||||
|
nameDraw();
|
||||||
}
|
}
|
Reference in New Issue
Block a user