Ejemplo n.º 1
0
 /// <summary>
 /// Checks collision of the entity on the BoundingBox.
 /// </summary>
 /// <param name="creature"></param>
 /// <returns></returns>
 public Boolean checkCollision(Mob creature)
 {
     if (creature.getY() + creature.getHeight() == ResourceHandler.getInstance().getBottom() - height) return true;
     else if (creature.getY() + creature.getHeight() > ResourceHandler.getInstance().getBottom() - height)
     {
         creature.setY(creature.getY() - 1);
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Checks collision on the side of the chunk.
 /// </summary>
 /// <param name="creature"></param>
 /// <returns></returns>
 public Boolean checkSideCollision(Mob creature)
 {
     //creature.moveY(-1);
     bool result = (creature.getY() - 2 + creature.getHeight() >= ResourceHandler.getInstance().getBottom() - height);
     //creature.moveY(1);
     return result;
 }
Ejemplo n.º 3
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;
        }