From 6fb6bc6aaf646e780822e8d6076dc2794091d2ab Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 25 Nov 2023 19:41:53 +0100 Subject: [PATCH] Removed homing bullets --- web/game.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/game.js b/web/game.js index 9f57890..1b2a135 100644 --- a/web/game.js +++ b/web/game.js @@ -146,6 +146,8 @@ function shoot(directionX, directionY) { if (!projectile) { // Set the initial position of the projectile to the player's position projectile = createVector(500, 100); + Xbuffer = directionX; + Ybuffer = directionY; } // Draw the small circle (projectile) @@ -153,7 +155,7 @@ function shoot(directionX, directionY) { circle(projectile.x, projectile.y, projSize); // Move the projectile towards the movable circle - let target = createVector(directionX, directionY); + let target = createVector(Xbuffer, Ybuffer); let direction = target.copy().sub(projectile); direction.normalize(); direction.mult(shotSpeed); @@ -184,6 +186,7 @@ function draw() { if (shot == false) { shoot(playerPosX, playerPosY); + } else { shot = false; }