added former and current position
This commit is contained in:
@@ -155,8 +155,9 @@ function shoot(directionX, directionY) {
|
|||||||
circle(projectile.x, projectile.y, projSize);
|
circle(projectile.x, projectile.y, projSize);
|
||||||
|
|
||||||
// Move the projectile towards the movable circle
|
// Move the projectile towards the movable circle
|
||||||
let target = createVector(Xbuffer, Ybuffer);
|
let targetFormer = createVector(Xbuffer, Ybuffer);
|
||||||
let direction = target.copy().sub(projectile);
|
let target = createVector(directionX, directionY);
|
||||||
|
let direction = targetFormer.copy().sub(projectile);
|
||||||
direction.normalize();
|
direction.normalize();
|
||||||
direction.mult(shotSpeed);
|
direction.mult(shotSpeed);
|
||||||
projectile.add(direction);
|
projectile.add(direction);
|
||||||
|
Reference in New Issue
Block a user