Sam
2024-01-08 19:24:25 +01:00

View File

@@ -214,6 +214,28 @@ async function keyPressed() {
}
}
}
if (homescreenOn && keyReleasedFlag) {
if (keyCode == UP_ARROW) {
buttonSelectHome -= 1;
keyReleasedFlag = false;
}
if (keyCode == DOWN_ARROW) {
buttonSelectHome += 1;
keyReleasedFlag = false;
}
if (buttonSelectHome == 0) {
if (keyCode == ENTER) {
homescreenOn = false;
reset();
}
}
if (buttonSelectHome == 1) {
if (keyCode == ENTER) {
homescreenOn = false;
reset();
}
}
}
}
function submit() {
@@ -266,6 +288,22 @@ function draw() {
if (homescreenOn == true) {
homescreen();
if (buttonSelectHome == 0) {
push()
stroke(205, 205, 205)
strokeWeight(2)
fill(0, 0, 0, 0)
rect(width / 2 - 90, height / 2, 200, 40)
pop()
}
if (buttonSelectHome == 1) {
push()
stroke(205, 205, 205)
strokeWeight(2)
fill(0, 0, 0, 0)
rect(width / 2 - 90, height / 2 + 50, 200, 40)
pop()
}
}
if (homescreenOn == false) {
game();
@@ -601,11 +639,11 @@ function button(r, g, b, buttonX, buttonY, buttonWidth, buttonHeight, buttonText
fill(r, g, b)
text(buttonText, buttonX + 100, buttonY + 30)
textAlign(CENTER);
if (mouseX > buttonX - 90 && mouseX < width / 2 + 110 && mouseY > height / 2 && mouseY < buttonY + 40) {
if (mouseIsPressed) {
homescreenOn = false;
}
}
// if (mouseX > buttonX - 90 && mouseX < width / 2 + 110 && mouseY > height / 2 && mouseY < buttonY + 40) {
// if (mouseIsPressed) {
// homescreenOn = false;
// }
// }
pop()
}