diff --git a/web/game.js b/web/game.js index 403afa2..b2efbdc 100644 --- a/web/game.js +++ b/web/game.js @@ -46,8 +46,6 @@ function life() { textAlign(CENTER); text(lives, 500, 20); if (hit == true) { - playerPosX = 500; - playerPosY = 300; hit = false; lives -= 1; } @@ -139,7 +137,6 @@ function draw() { life(); // draw background background(0, 0, 0, 100); - if (!(lives == 0)) { // draw player fill(0, 255, 255) diff --git a/web/index.html b/web/index.html index 9b2359b..c2f686e 100644 --- a/web/index.html +++ b/web/index.html @@ -9,6 +9,7 @@ + diff --git a/web/js/basicbullet.js b/web/js/basicbullet.js new file mode 100644 index 0000000..ef7734a --- /dev/null +++ b/web/js/basicbullet.js @@ -0,0 +1,24 @@ +class bullet { + constructor(x, y, angle, speed, radius, color) { + //"This" moet gebruikt worden om de variabelen aan te maken in de class en het zorgt er voor dat de variabelen niet alleen in de constructor gebruikt kunnen worden, + //maar ook in de rest van de class + this.x = x; + this.y = y; + this.angle = angle; + this.speed = speed; + this.radius = radius; + this.color = color; + +} + + +draw() { + //push en pop zorgen er voor dat de code tussen push en pop een eigen canvas heeft. Dus dat er meerdere projectielen tegelijk kunnen zijn. + push(); + fill(255, 0, 0); + circle(projectile.x, projectile.y, projSize); + pop(); +} + + +} \ No newline at end of file