Ejemplo n.º 1
0
  // fires
  public void checkFireCrush(ArrayList<Fire> fires, int i) {
    Fire fire = fires.get(i);

    if (fire.isReverse()) {
      if (x - width / 2 < fire.getX() - fire.getWidth() / 2
          && x + width / 2 >= fire.getX() - fire.getWidth() / 2
          && y + height / 2 > fire.getY() + fire.getHeight() / 2
          && y - height / 2 < fire.getY() + fire.getHeight() / 2 - height / 2) {
        x = startX;
        y = startY;
        reverse = false;
        falling = false;
        hit();
      } else {
        if (x + width / 2 > fire.getX() + fire.getWidth() / 2
            && x - width / 2 <= fire.getX() + fire.getWidth() / 2
            && y + height / 2 > fire.getY() + fire.getHeight() / 2
            && y - height / 2 < fire.getY() + fire.getHeight() / 2 - height / 2) {
          x = startX;
          y = startY;
          reverse = false;
          falling = false;
          hit();
        } else {
          if (x + width / 2 > fire.getX() - fire.getWidth() / 2
              && x - width / 2 < fire.getX() + fire.getWidth() / 2
              && y + height / 2 > fire.getY() + fire.getHeight() / 2
              && y - height / 2 <= fire.getY() + fire.getHeight() / 2) {
            x = startX;
            y = startY;
            reverse = false;
            falling = false;
            hit();
          }
        }
      }
    } else {
      if (x - width / 2 < fire.getX() - fire.getWidth() / 2
          && x + width / 2 >= fire.getX() - fire.getWidth() / 2
          && y - height / 2 < fire.getY() - fire.getHeight() / 2
          && y + height / 2 > fire.getY() - fire.getHeight() / 2 + height / 2) {
        x = startX;
        y = startY;
        reverse = false;
        falling = false;
        hit();
      } else {
        if (x + width / 2 > fire.getX() + fire.getWidth() / 2
            && x - width / 2 <= fire.getX() + fire.getWidth() / 2
            && y - height / 2 < fire.getY() - fire.getHeight() / 2
            && y + height / 2 > fire.getY() - fire.getHeight() / 2 + height / 2) {
          x = startX;
          y = startY;
          reverse = false;
          falling = false;
          hit();
        } else {
          if (x - width / 2 < fire.getX() + fire.getWidth() / 2
              && x + width / 2 > fire.getX() - fire.getWidth() / 2
              && y - height / 2 < fire.getY() - fire.getHeight() / 2
              && y + height / 2 >= fire.getY() - fire.getHeight() / 2) {
            x = startX;
            y = startY;
            reverse = false;
            falling = false;
            hit();
          }
        }
      }
    }
  }