diff --git a/webdev/js/basicbullet.js b/webdev/basicbullet.js
similarity index 86%
rename from webdev/js/basicbullet.js
rename to webdev/basicbullet.js
index df80929..5ab7750 100644
--- a/webdev/js/basicbullet.js
+++ b/webdev/basicbullet.js
@@ -3,8 +3,10 @@ class bullet {
constructor(targetx, targety, radius, speed) {
//"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 = targetx;
- this.y = targety;
+ this.targetx = targetx;
+ this.targety = targety;
+ this.x = 500;
+ this.y = 100;
this.radius = radius;
this.speed = speed;
@@ -14,7 +16,7 @@ class bullet {
this.y = directionY;
// Calculate the initial direction
- direction = createVector(targetX - projectile.x, targetY - projectile.y);
+ direction = createVector(this.targetX - projectile.x, this.targetY - projectile.y);
direction.normalize();
}
diff --git a/webdev/game.js b/webdev/game.js
index 9881609..26681db 100644
--- a/webdev/game.js
+++ b/webdev/game.js
@@ -73,8 +73,7 @@ let playerPosY = 300;
let bullets = [];
let playerSpeed = 5;
let radius = 20;
-let myBullet = new bullet();
-
+let myBullet = new bullet();
async function Movementloop() {
if (booleanArray[1]) {
@@ -109,6 +108,7 @@ function setup(){
frameRate(244);
// disable the outline of shapes
noStroke();
+ myBullet(playerPosX, playerPosY, radius, 5);
}
// the function draw() is called every frame
diff --git a/webdev/index.html b/webdev/index.html
index c2f686e..2f3bd0a 100644
--- a/webdev/index.html
+++ b/webdev/index.html
@@ -9,7 +9,7 @@
-
+