Merge branch 'main' of https://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-2/cuujooceevii61
This commit is contained in:
@@ -20,4 +20,5 @@ nav:
|
|||||||
- SQL : documentatie/sql
|
- SQL : documentatie/sql
|
||||||
- P5.md : documentatie/p5
|
- P5.md : documentatie/p5
|
||||||
- Feedback : documentatie/Feedback
|
- Feedback : documentatie/Feedback
|
||||||
- Documentatie : "documentatie/Documentatie game"
|
- Positioning : documentatie/positioning
|
||||||
|
- Documentatie game : "documentatie/Documentatie game"
|
2
docs/documentatie/positioning.md
Normal file
2
docs/documentatie/positioning.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
## fuck
|
||||||
|
door gebruik te maken van rectMode center kunnen we gebruik maken van dingen als width/4 zodat het op alle schermgroottes mogelijk is.
|
24
web/game.js
24
web/game.js
@@ -75,6 +75,7 @@ function setup() {
|
|||||||
createCanvas(width, height);
|
createCanvas(width, height);
|
||||||
frameRate(framerate);
|
frameRate(framerate);
|
||||||
angleMode(DEGREES);
|
angleMode(DEGREES);
|
||||||
|
rectMode(CENTER);
|
||||||
// disable the outline of shapes
|
// disable the outline of shapes
|
||||||
noStroke();
|
noStroke();
|
||||||
}
|
}
|
||||||
@@ -320,7 +321,7 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 90, height / 2, 200, 40)
|
rect(width / 2, height / 2, 200, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
if (buttonSelectHome == 1) {
|
if (buttonSelectHome == 1) {
|
||||||
@@ -328,7 +329,7 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 90, height / 2 + 50, 200, 40)
|
rect(width / 2, height / 2 + 50, 200, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,7 +348,8 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 100, height / 2, 200, 40)
|
rectMode(CENTER);
|
||||||
|
rect(width / 2, height / 2, 200, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
if (buttonSelectPause == 1) {
|
if (buttonSelectPause == 1) {
|
||||||
@@ -355,7 +357,8 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 100, height / 2 + 50, 200, 40)
|
rectMode(CENTER);
|
||||||
|
rect(width / 2, height / 2 + 50, 200, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -363,10 +366,11 @@ function draw() {
|
|||||||
if (entered) {
|
if (entered) {
|
||||||
if (buttonSelectDead == 0) {
|
if (buttonSelectDead == 0) {
|
||||||
push()
|
push()
|
||||||
|
|
||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 45, height / 2 - 30, 90, 40)
|
rect(width / 2, height / 2 - 15, 90, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
if (buttonSelectDead == 1) {
|
if (buttonSelectDead == 1) {
|
||||||
@@ -374,7 +378,7 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 55, height / 2 + 15, 110, 40)
|
rect(width / 2, height / 2 + 30, 110, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
if (buttonSelectDead == 2) {
|
if (buttonSelectDead == 2) {
|
||||||
@@ -382,7 +386,7 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 80, height / 2 + 60, 160, 40)
|
rect(width / 2, height / 2 + 75, 160, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,7 +396,7 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 45, height / 2 - 30, 30, 40)
|
rect(width / 2 - 30, height / 2 - 15, 30, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
if (iIndex == 1) {
|
if (iIndex == 1) {
|
||||||
@@ -400,7 +404,7 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 - 15, height / 2 - 30, 30, 40)
|
rect(width / 2, height / 2 - 15, 30, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
if (iIndex == 2) {
|
if (iIndex == 2) {
|
||||||
@@ -408,7 +412,7 @@ function draw() {
|
|||||||
stroke(205, 205, 205)
|
stroke(205, 205, 205)
|
||||||
strokeWeight(2)
|
strokeWeight(2)
|
||||||
fill(0, 0, 0, 0)
|
fill(0, 0, 0, 0)
|
||||||
rect(width / 2 + 15, height / 2 - 30, 30, 40)
|
rect(width / 2 + 30, height / 2 - 15, 30, 40)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,31 +17,28 @@ function keyPressed() {
|
|||||||
|
|
||||||
function homescreen() {
|
function homescreen() {
|
||||||
textAlign(CENTER);
|
textAlign(CENTER);
|
||||||
button(255, 255, 255, width / 2 - 90, height / 2, 200, 40, "Start Game")
|
button(255, 255, 255, width / 2, height / 2, 200, 40, "Start Game")
|
||||||
button(255, 255, 255, width / 2 - 90, height / 2 + 50, 200, 40, "Scores")
|
button(255, 255, 255, width / 2, height / 2 + 50, 200, 40, "Scores")
|
||||||
|
|
||||||
push()
|
push()
|
||||||
stroke(255, 255, 255)
|
stroke(255, 255, 255)
|
||||||
strokeWeight(5)
|
strokeWeight(5)
|
||||||
fill(0, 255, 0, 0)
|
fill(0, 255, 0, 0)
|
||||||
rect(100, 150, 300, 400)
|
rect(width/4*3, height/2, 300, 400)
|
||||||
pop()
|
pop()
|
||||||
//highscores rectangle
|
//highscores rectangle
|
||||||
push()
|
push()
|
||||||
textSize(50)
|
textSize(50)
|
||||||
fill(255, 255, 255)
|
fill(255, 255, 255)
|
||||||
text("Highscores", 250, 200)
|
text("Highscores", width/4, 200)
|
||||||
pop()
|
pop()
|
||||||
|
|
||||||
push()
|
push()
|
||||||
fill(255, 255, 255)
|
fill(255, 255, 255)
|
||||||
textSize(25)
|
textSize(25)
|
||||||
textAlign(CENTER)
|
textAlign(CENTER)
|
||||||
// if (requesteddata.length > 0) {
|
|
||||||
// text("1. " + requesteddata[0].Naam + ": " + requesteddata[0].Score, 250, 250)
|
|
||||||
// }
|
|
||||||
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, 250, 250 + (i * 30))
|
text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score, width/4, 250 + (i * 30))
|
||||||
}
|
}
|
||||||
pop()
|
pop()
|
||||||
|
|
||||||
@@ -49,29 +46,26 @@ function homescreen() {
|
|||||||
stroke(255, 255, 255)
|
stroke(255, 255, 255)
|
||||||
strokeWeight(5)
|
strokeWeight(5)
|
||||||
fill(0, 255, 0, 0)
|
fill(0, 255, 0, 0)
|
||||||
rect(860, 150, 300, 400)
|
rect(width/4, height/2, 300, 400)
|
||||||
pop()
|
pop()
|
||||||
|
|
||||||
push()
|
push()
|
||||||
textSize(50)
|
textSize(50)
|
||||||
fill(255, 255, 255)
|
fill(255, 255, 255)
|
||||||
text("Controls", 1000, 200)
|
text("Controls", width/4*3, 200)
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
function button(r, g, b, buttonX, buttonY, buttonWidth, buttonHeight, buttonText) {
|
function button(r, g, b, buttonX, buttonY, buttonWidth, buttonHeight, buttonText) {
|
||||||
push()
|
push()
|
||||||
fill(0, 0, 50)
|
fill(0, 0, 50)
|
||||||
|
rectMode(CENTER);
|
||||||
rect(buttonX, buttonY, buttonWidth, buttonHeight)
|
rect(buttonX, buttonY, buttonWidth, buttonHeight)
|
||||||
textSize(25)
|
textSize(25)
|
||||||
fill(r, g, b)
|
fill(r, g, b)
|
||||||
text(buttonText, buttonX + 100, buttonY + 30)
|
|
||||||
textAlign(CENTER);
|
textAlign(CENTER);
|
||||||
// if (mouseX > buttonX - 90 && mouseX < width / 2 + 110 && mouseY > height / 2 && mouseY < buttonY + 40) {
|
text(buttonText, buttonX, buttonY + buttonHeight/4)
|
||||||
// if (mouseIsPressed) {
|
|
||||||
// homescreenOn = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +74,6 @@ function pauseMenu(){
|
|||||||
textSize(50);
|
textSize(50);
|
||||||
fill(255, 255, 255);
|
fill(255, 255, 255);
|
||||||
text("Paused", width / 2, height / 2 - 100);
|
text("Paused", width / 2, height / 2 - 100);
|
||||||
button(255, 255, 255, width / 2 - 100, height / 2, 200, 40, "Resume");
|
button(255, 255, 255, width / 2, height / 2, 200, 40, "Resume");
|
||||||
button(255, 255, 255, width / 2 - 100, height / 2 + 50, 200, 40, "Main Menu");
|
button(255, 255, 255, width / 2, height / 2 + 50, 200, 40, "Main Menu");
|
||||||
}
|
}
|
Reference in New Issue
Block a user