Hitbox intersect checks rather than distance.

This commit is contained in:
mountaindrew10 committed 2024-04-29 11:52:59 -05:00
1 parent 5bb11f414d
commit becc3d2228
2 files changed
+2 -4

No files matched your search

+1 -2
View File
@@ -83,7 +83,6 @@ namespace CalamityMod.Projectiles.Boss
float maxAcceleration = death ? 0.44f : 0.4f;
float timeBeforeHoming = death ? 30f : 45f;
float distanceAboveTargetBeforeHomingDownward = death ? 400f : 480f;
float explodeDistance = 16f;
if (Projectile.ai[0] == 0f)
{
Projectile.localAI[0] += 1f;
@@ -127,7 +126,7 @@ namespace CalamityMod.Projectiles.Boss
Projectile.tileCollide = true;
Vector2 playerDistance = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center;
if (playerDistance.Length() < explodeDistance)
if (Projectile.Hitbox.Intersects(Main.player[(int)Projectile.ai[1]].Hitbox))
{
Projectile.Kill();
return;
+1 -2
View File
@@ -2247,8 +2247,7 @@ namespace CalamityMod.Projectiles
int target = 0;
target = Player.FindClosest(projectile.Center, 1, 1);
// Blow up when within a certain distance of the target
if (Vector2.Distance(projectile.Center, Main.player[target].Center) < 16f)
if (projectile.Hitbox.Intersects(Main.player[target].Hitbox))
{
projectile.Kill();
return false;