/// <summary> /// Gets the distance from another entity. /// </summary> /// <param name="creature"></param> /// <returns></returns> public float getDistanceFrom(Mob creature) { return Vector2.Distance(getVector(), creature.getVector()); }
/// <summary> /// Checks entity collision. /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool collidingWith(Mob entity) { if (getVector().X + getWidth() >= entity.getVector().X && getVector().X <= entity.getVector().X + entity.getWidth()) { if (getVector().Y + getHeight() >= entity.getVector().Y && getVector().Y <= entity.getVector().Y + entity.getHeight()) { return true; } } return false; }