Exemplo n.º 1
0
 /// <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());
 }
Exemplo n.º 2
0
        /// <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;
        }