コード例 #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;
 }
コード例 #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;
 }