diff --git a/web/game.js b/web/game.js index 1b2a135..04bb7ff 100644 --- a/web/game.js +++ b/web/game.js @@ -155,8 +155,9 @@ function shoot(directionX, directionY) { circle(projectile.x, projectile.y, projSize); // Move the projectile towards the movable circle - let target = createVector(Xbuffer, Ybuffer); - let direction = target.copy().sub(projectile); + let targetFormer = createVector(Xbuffer, Ybuffer); + let target = createVector(directionX, directionY); + let direction = targetFormer.copy().sub(projectile); direction.normalize(); direction.mult(shotSpeed); projectile.add(direction);