Removed off screen bullets that was causing lag

This commit is contained in:
Sam
2023-11-30 22:38:17 +01:00
parent e98ce2415d
commit 78c95b29f7
2 changed files with 9 additions and 2 deletions

View File

@@ -45,7 +45,9 @@ class bullet {
} else if (this.projectile.x < 0 - 10 || this.projectile.x > width + 10 || this.projectile.y < 0 - 10 || this.projectile.y > height + 10) {
shot = false;
}
let isOffScreen = this.projectile.x < 0 || this.projectile.x > width || this.projectile.y < 0 || this.projectile.y > height;
return { hit, shot };
return { hit, shot, isOffScreen};
}
}