Removed homing bullets
This commit is contained in:
@@ -146,6 +146,8 @@ function shoot(directionX, directionY) {
|
|||||||
if (!projectile) {
|
if (!projectile) {
|
||||||
// Set the initial position of the projectile to the player's position
|
// Set the initial position of the projectile to the player's position
|
||||||
projectile = createVector(500, 100);
|
projectile = createVector(500, 100);
|
||||||
|
Xbuffer = directionX;
|
||||||
|
Ybuffer = directionY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the small circle (projectile)
|
// Draw the small circle (projectile)
|
||||||
@@ -153,7 +155,7 @@ 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(directionX, directionY);
|
let target = createVector(Xbuffer, Ybuffer);
|
||||||
let direction = target.copy().sub(projectile);
|
let direction = target.copy().sub(projectile);
|
||||||
direction.normalize();
|
direction.normalize();
|
||||||
direction.mult(shotSpeed);
|
direction.mult(shotSpeed);
|
||||||
@@ -184,6 +186,7 @@ function draw() {
|
|||||||
|
|
||||||
if (shot == false) {
|
if (shot == false) {
|
||||||
shoot(playerPosX, playerPosY);
|
shoot(playerPosX, playerPosY);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
shot = false;
|
shot = false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user