public static bool monstersColliding(Familiar m1, Monster m2) { if (m1.Equals(m2) || m1.Health <= 0 || m2.Health <= 0 || m2.IsInvisible) { return(false); } Rectangle m1l = m1.GetBoundingBox(); Rectangle m2l = m2.GetBoundingBox(); return(m1l.Intersects(m2l)); }
public static bool withinMonsterThreshold(Familiar m1, Monster m2, int threshold) { if (m1.Equals(m2) || m1.Health <= 0 || m2.Health <= 0 || m2.IsInvisible || m2.isInvincible()) { return(false); } Vector2 m1l = m1.getTileLocation(); Vector2 m2l = m2.getTileLocation(); return(Math.Abs(m2l.X - m1l.X) <= (float)threshold && Math.Abs(m2l.Y - m1l.Y) <= (float)threshold); }