From abefdf3870821cbb38dee66d2526b0e94c85366a Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 5 Dec 2023 15:48:55 +0100 Subject: [PATCH 1/4] Started creation startscreen --- web/game.js | 2 ++ web/js/homescreen.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 web/js/homescreen.js diff --git a/web/game.js b/web/game.js index 8939190..7592018 100644 --- a/web/game.js +++ b/web/game.js @@ -48,6 +48,7 @@ let y5; let bulletAmount = 10; +let Startscreen = new Startscreen(width, height); //let myBullet = new bullet(); // the function setup() is called once when the page is loaded @@ -61,6 +62,7 @@ function setup() { // disable the outline of shapes Movementloop() noStroke(); + } function score() { diff --git a/web/js/homescreen.js b/web/js/homescreen.js new file mode 100644 index 0000000..39f1137 --- /dev/null +++ b/web/js/homescreen.js @@ -0,0 +1,23 @@ +class Startscreen { + constructor(width, height) { + this.width = width; + this.height = height; + + } + + setup() { + createCanvas(this.width, this.height); + + } + + + draw() { + circle(100, 100, 100) + } + + update() { + + } + + +} \ No newline at end of file From cbf5bdd5931b7d71c263481f45825af8628cdf94 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 5 Dec 2023 15:49:01 +0100 Subject: [PATCH 2/4] Added documentation --- docs/documentatie/presentatie.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/documentatie/presentatie.md b/docs/documentatie/presentatie.md index 62838ff..b88fb65 100644 --- a/docs/documentatie/presentatie.md +++ b/docs/documentatie/presentatie.md @@ -1 +1,4 @@ -# Presentie \ No newline at end of file +# Presentie + +De presentatie ging goed, we waren wel een aantal dingen vergeten zoals de feedback van mensen over de wireflow opnemen in de presentatie. We moesten ook beter onderzoek doen over de doelgroep en dat meer laten zien in de presentatie. + From 726d60c05730d9bbc02c34533d4d596939f9fb95 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 5 Dec 2023 15:49:07 +0100 Subject: [PATCH 3/4] Added js class --- web/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/web/index.html b/web/index.html index c2f686e..438fd4d 100644 --- a/web/index.html +++ b/web/index.html @@ -10,6 +10,7 @@ + From 2b4d331b770d28827ffdc6795443c89b5593d42b Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 6 Dec 2023 13:19:51 +0100 Subject: [PATCH 4/4] added push and pop to every drawing --- web/game.js | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/web/game.js b/web/game.js index d04b6fc..ccb30c9 100644 --- a/web/game.js +++ b/web/game.js @@ -45,11 +45,8 @@ let x4; let y4; let x5; let y5; - +let homescreenOn = false; let bulletAmount = 10; - -let Startscreen = new Startscreen(width, height); - //let myBullet = new bullet(); // the function setup() is called once when the page is loaded function setup() { @@ -62,7 +59,6 @@ function setup() { // disable the outline of shapes Movementloop() noStroke(); - } function score() { @@ -72,10 +68,12 @@ function score() { function life() { textAlign(CENTER); if (lives == 0) { + push(); fill(255, 0, 0); textSize(40); textAlign(CENTER); text("Game Over", width/2, height/2); + pop(); if (key == ' ') { lives = 1; time = 0; @@ -150,7 +148,6 @@ async function Movementloop() { // the function draw() is called every frame function draw() { - textSize(10); keyPressed(); life(); // draw background @@ -158,18 +155,35 @@ function draw() { background(0, 0, 0, 100); if (!(lives == 0)) { // draw player + push(); fill(0, 255, 255) circle(constrain(playerPosX, 0 + radius, width - radius), constrain(playerPosY, 0 + radius, height - radius), playerSize); + pop(); movementCheck() // draw boss + push(); fill(255, 165, 0) circle(x2, y2, 50); + pop(); if (hasMoved == true) { + push(); score(); + textSize(10); + textAlign(LEFT); + fill(255, 0, 255) + text(int(time), 10, 20); + pop(); + } + if (hasMoved == false) { + push(); + score(); + textSize(10); + textAlign(LEFT); + fill(255, 0, 255) + text(0, 10, 20); + pop(); } - textAlign(LEFT); - text(int(time), 10, 20); randomAttackPattern() if (patern == 2) { @@ -185,9 +199,14 @@ function draw() { y4 = map(cosY, -1, 1, playerPosY - 100, playerPosY + 100); x5 = map(sinX, -1, 1, playerPosX - 100, playerPosX + 100); y5 = map(-cosY, -1, 1, playerPosY - 100, playerPosY + 100); + push(); + fill(255, 165, 0) circle(x3, y3, 50); circle(x4, y4, 50); circle(x5, y5, 50); + pop(); + + } else { x2 = width / 2; y2 = 100; @@ -206,6 +225,11 @@ function draw() { //blijf de bullet tekenen zolang hit false is bullets = bullets.filter(bullet => !bullet.hit); } + + + if (homescreenOn == true) { + homescreen(); + } } function randomAttackPattern() { @@ -293,4 +317,12 @@ function spawnRandomBullet() { } angle = 0; } -} \ No newline at end of file +} + + +function homescreen() { + push() + circle(100, 100, 100) + color(255, 0, 255, 200) + pop() +}