From 6feaa8e08ebbb134605c0edaa5f5e10ccd959f07 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 5 Dec 2023 13:23:09 +0100 Subject: [PATCH] Added bullet original pos return paramater --- web/game.js | 2 +- web/js/basicbullet.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/web/game.js b/web/game.js index 04e46f9..1f220db 100644 --- a/web/game.js +++ b/web/game.js @@ -178,7 +178,7 @@ function draw() { bullets.forEach(myBullet => { //zolang mybullet bestaat blijft hij drawen en updaten - ({ hit, shot, isOffScreen } = myBullet.update(playerPosX, playerPosY)); + ({ hit, shot, isOffScreen, originalPos } = myBullet.update(playerPosX, playerPosY)); myBullet.draw(); if (isOffScreen == true) { diff --git a/web/js/basicbullet.js b/web/js/basicbullet.js index b69e6c2..1ba2506 100644 --- a/web/js/basicbullet.js +++ b/web/js/basicbullet.js @@ -49,8 +49,9 @@ class bullet { shot = false; } let isOffScreen = this.projectile.x < 0 || this.projectile.x > width || this.projectile.y < 0 || this.projectile.y > height; + let originalPos = this.projectile.x == this.targetx || this.projectile.y == this.targety; - return { hit, shot, isOffScreen}; + return { hit, shot, isOffScreen, originalPos}; } } \ No newline at end of file