added former and current position
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user