Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-2/cuujooceevii61

This commit is contained in:
Mees Roelofsz
2024-01-10 15:58:36 +01:00
6 changed files with 155 additions and 64 deletions

View File

@@ -585,69 +585,6 @@ function spawnRandomBullet() {
}
}
function homescreen() {
textAlign(CENTER);
button(255, 255, 255, width / 2 - 90, height / 2, 200, 40, "Start Game")
button(255, 255, 255, width / 2 - 90, height / 2 + 50, 200, 40, "Scores")
push()
stroke(255, 255, 255)
strokeWeight(5)
fill(0, 255, 0, 0)
rect(100, 150, 300, 400)
pop()
//highscores rectangle
push()
textSize(50)
fill(255, 255, 255)
text("Highscores", 250, 200)
pop()
push()
fill(255, 255, 255)
textSize(25)
textAlign(CENTER)
// if (requesteddata.length > 0) {
// text("1. " + requesteddata[0].Naam + ": " + requesteddata[0].Score, 250, 250)
// }
for (let i = 0; i < requesteddata.length; i++) {
text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score, 250, 250 + (i * 30))
}
pop()
push()
stroke(255, 255, 255)
strokeWeight(5)
fill(0, 255, 0, 0)
rect(860, 150, 300, 400)
pop()
push()
textSize(50)
fill(255, 255, 255)
text("Controls", 1000, 200)
pop()
}
function button(r, g, b, buttonX, buttonY, buttonWidth, buttonHeight, buttonText) {
push()
fill(0, 0, 50)
rect(buttonX, buttonY, buttonWidth, buttonHeight)
textSize(25)
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;
// }
// }
pop()
}
function game() {
if (!(lives == 0)) {
// draw player

View File

@@ -10,6 +10,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/addons/p5.sound.min.js"></script>
<script src="js/basicbullet.js"></script>
<script src="js/Database.js"></script>
<script src="js/Menu.js"></script>
<script src="game.js"></script>
</head>
<body>

65
web/js/Menu.js Normal file
View File

@@ -0,0 +1,65 @@
function scoremenu(){
}
function homescreen() {
textAlign(CENTER);
button(255, 255, 255, width / 2 - 90, height / 2, 200, 40, "Start Game")
button(255, 255, 255, width / 2 - 90, height / 2 + 50, 200, 40, "Scores")
push()
stroke(255, 255, 255)
strokeWeight(5)
fill(0, 255, 0, 0)
rect(100, 150, 300, 400)
pop()
//highscores rectangle
push()
textSize(50)
fill(255, 255, 255)
text("Highscores", 250, 200)
pop()
push()
fill(255, 255, 255)
textSize(25)
textAlign(CENTER)
// if (requesteddata.length > 0) {
// text("1. " + requesteddata[0].Naam + ": " + requesteddata[0].Score, 250, 250)
// }
for (let i = 0; i < requesteddata.length; i++) {
text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score, 250, 250 + (i * 30))
}
pop()
push()
stroke(255, 255, 255)
strokeWeight(5)
fill(0, 255, 0, 0)
rect(860, 150, 300, 400)
pop()
push()
textSize(50)
fill(255, 255, 255)
text("Controls", 1000, 200)
pop()
}
function button(r, g, b, buttonX, buttonY, buttonWidth, buttonHeight, buttonText) {
push()
fill(0, 0, 50)
rect(buttonX, buttonY, buttonWidth, buttonHeight)
textSize(25)
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;
// }
// }
pop()
}