Sand cloak veil now has a circular hitbox
This commit is contained in:
1 parent
5a0b79222e
commit
d853e3fbbc
1 file changed
+19
@@ -107,5 +107,24 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
target.velocity = trueKnockback * knockbackMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
// Circular hitbox code copied from HeliumFlashBlast
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft());
|
||||
float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight());
|
||||
float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft());
|
||||
float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight());
|
||||
|
||||
float minDist = dist1;
|
||||
if (dist2 < minDist)
|
||||
minDist = dist2;
|
||||
if (dist3 < minDist)
|
||||
minDist = dist3;
|
||||
if (dist4 < minDist)
|
||||
minDist = dist4;
|
||||
|
||||
return minDist <= radius;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user