added collision with boss & first wave can now hit (thx sam)
This commit is contained in:
@@ -11,7 +11,6 @@ class bullet {
|
||||
this.bulletHit = false;
|
||||
this.directionX = null;
|
||||
this.directionY = null;
|
||||
this.hasMoved = hasMoved;
|
||||
// Set a variable that cant be changed
|
||||
if ((this.directionX === null) || (this.directionY === null)) {
|
||||
this.directionX = this.targetx;
|
||||
@@ -33,7 +32,7 @@ class bullet {
|
||||
pop();
|
||||
}
|
||||
|
||||
update(targetx, targety) {
|
||||
update(targetx, targety, hasMoved) {
|
||||
// keeps the projetile updated so hit collision can be checked
|
||||
this.targetx = targetx;
|
||||
this.targety = targety;
|
||||
@@ -48,7 +47,7 @@ class bullet {
|
||||
hit = true;
|
||||
shot = false;
|
||||
// if the projectile has hit the player and the player has lives left, remove a life
|
||||
if (this.hasMoved && lives != 0 && this.bulletHit == false) {
|
||||
if (hasMoved && lives != 0 && this.bulletHit == false) {
|
||||
this.bulletHit = true;
|
||||
lives -= 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user