Package rectangles

Examples of rectangles.FireRingRectangle


    this.map = map;
    fireImage = new ImageIcon("images/fireRing.png").getImage();
    health = -1;// can't be destroyed
    // 25 is to offset for the size so it's not off the field
    d = Direction.NORTH;
    rect = new FireRingRectangle(location.col - 25, location.row - 25);
    FireThread ft = new FireThread();
    ft.start();

  }
View Full Code Here


    if(enemies.size() != 0) {
    enemy = enemies.getFirst();
    }
    if (d == Direction.EAST) {
      location = new Point(location.row, location.col + 1);
      rect = new FireRingRectangle(location.col - 25, location.row - 25);
      if(enemy.getHuman() == 0) {
      if(enemy.getRectangle().intersects(rect)) {
        location = new Point(location.row, location.col - 1);
        rect = new FireRingRectangle(location.col - 25, location.row - 25);
        moveable = false;
        return false;
      }
      }
      for (int i = 0; i < obs.size(); i++) {
        Obstacle o = obs.get(i);
          if (o instanceof ImmovableBlock) {
            if (((ImmovableBlock) o).getRectangle()
                .intersects(rect)) {
              location = new Point(location.row, location.col - 1);
              rect = new FireRingRectangle(location.col - 25,
                  location.row - 25);
              moveable = false;
              return false;
            }

          }
          if (o instanceof TNT) {
            if (((TNT) o).getRectangle().intersects(rect)) {
              location = new Point(location.row, location.col - 1);
              rect = new FireRingRectangle(location.col - 25,
                  location.row - 25);
              moveable = false;
              return false;
            }
          }
          if (o instanceof Crate) {
            if (((Crate) o).getRectangle().intersects(rect)) {
              location = new Point(location.row, location.col - 1);
              rect = new FireRingRectangle(location.col - 25,
                  location.row - 25);
              moveable = false;
              return false;
            }
          }
          if (o instanceof FireRing) {
            if (o != this) {
              if (((FireRing) o).getRectangle().intersects(rect)) {
                location = new Point(location.row,
                    location.col - 1);
                rect = new FireRingRectangle(location.col - 25,
                    location.row - 25);
                moveable = false;
                return false;
              }
            }
          }

        }
     
      if (location.col > 955) {
        location = new Point(location.row, location.col - 1);
        rect = new FireRingRectangle(location.col - 25,
            location.row - 25);
        moveable = false;
        return false;
      }
      moveable = true;
      notifyObservers(this);
      setChanged();

    }
    if (d == Direction.WEST) {
      location = new Point(location.row, location.col - 1);
      rect = new FireRingRectangle(location.col - 25, location.row - 25);
      if(enemy.getHuman() == 0) {
      if(enemy.getRectangle().intersects(rect)) {
        location = new Point(location.row, location.col + 1);
        rect = new FireRingRectangle(location.col - 25, location.row - 25);
        moveable = false;
        return false;
      }
      }
      for (int i = 0; i < obs.size(); i++) {
        Obstacle o = obs.get(i);
        if(o instanceof ImmovableBlock) {
          if(((ImmovableBlock) o).getRectangle().intersects(rect)) {
            location = new Point(location.row, location.col + 1);
            rect = new FireRingRectangle(location.col - 25, location.row - 25);
            moveable = false;
            return false;

          }
        }
          if (o instanceof TNT) {
            if (((TNT) o).getRectangle().intersects(rect)) {
              location = new Point(location.row, location.col + 1);
              rect = new FireRingRectangle(location.col - 25,
                  location.row - 25);
              moveable = false;
              return false;
            }
          }
          if (o instanceof Crate) {
            if (((Crate) o).getRectangle().intersects(rect)) {
              location = new Point(location.row, location.col + 1);
              rect = new FireRingRectangle(location.col - 25,
                  location.row - 25);
              moveable = false;
              return false;
            }
          }
          if (o instanceof FireRing) {
            if (o != this) {
              if (((FireRing) o).getRectangle().intersects(rect)) {
                location = new Point(location.row,
                    location.col + 1);
                rect = new FireRingRectangle(location.col - 25,
                    location.row - 25);
                moveable = false;
                return false;
              }
            }
          }
        }
      if (location.col < 30) {
        location = new Point(location.row, location.col + 1);
        rect = new FireRingRectangle(location.col - 25,
            location.row - 25);
        moveable = false;
        return false;
      }
      moveable = true;
      notifyObservers(this);
      setChanged();
    }
    if (d == Direction.NORTH) {
      location = new Point(location.row - 1, location.col);
      rect = new FireRingRectangle(location.col - 25, location.row - 25);
      if(enemy.getHuman() == 0) {
      if(enemy.getRectangle().intersects(rect)) {
        location = new Point(location.row + 1, location.col);
        rect = new FireRingRectangle(location.col - 25, location.row - 25);
        moveable = false;
        return false;
      }
      }
      for (int i = 0; i < obs.size(); i++) {
        Obstacle o = obs.get(i);
        if(o instanceof ImmovableBlock) {
          if(((ImmovableBlock) o).getRectangle().intersects(rect)) {
            location = new Point(location.row + 1, location.col);
            rect = new FireRingRectangle(location.col - 25, location.row - 25);
            moveable = false;
            return false;
          }
        }

          if (o instanceof TNT) {
            if (((TNT) o).getRectangle().intersects(rect)) {
              location = new Point(location.row + 1, location.col);
              rect = new FireRingRectangle(location.col - 25,
                  location.row - 25);
              moveable = false;
              return false;
            }
          }
 
        if(o instanceof Crate) {
          if(((Crate) o).getRectangle().intersects(rect)) {
            location = new Point(location.row + 1, location.col);
            rect = new FireRingRectangle(location.col - 25, location.row - 25);
            moveable = false;
            return false;


          }

        }
        if(o instanceof FireRing) {
          if(o != this) {
          if(((FireRing) o).getRectangle().intersects(rect)) {
            location = new Point(location.row + 1, location.col);
            rect = new FireRingRectangle(location.col - 25, location.row - 25);
            moveable = false;
            return false;
          }
          }
        }

      }
      if (location.row < 30) {
        location = new Point(location.row + 1, location.col);
        rect = new FireRingRectangle(location.col - 25,
            location.row - 25);
        moveable = false;
        return false;
      }
      moveable = true;
      notifyObservers(this);
      setChanged();

    }
    if (d == Direction.SOUTH) {
      location = new Point(location.row + 1, location.col);
      rect = new FireRingRectangle(location.col - 25, location.row - 25);
      if(enemy.getHuman() == 0) {
      if(enemy.getRectangle().intersects(rect)) {
        location = new Point(location.row - 1, location.col);
        rect = new FireRingRectangle(location.col - 25, location.row - 25);
        moveable = false;
        return false;
      }
      }
      for (int i = 0; i < obs.size(); i++) {
        Obstacle o = obs.get(i);
        if(o instanceof ImmovableBlock) {
          if(((ImmovableBlock) o).getRectangle().intersects(rect)) {
            location = new Point(location.row - 1, location.col);
            rect = new FireRingRectangle(location.col - 25, location.row - 25);
            moveable = false;
            return false;
          }
        }
          if (o instanceof TNT) {
            if (((TNT) o).getRectangle().intersects(rect)) {
              location = new Point(location.row - 1, location.col);
              rect = new FireRingRectangle(location.col - 25,
                  location.row - 25);
              moveable = false;
              return false;
            }
          }
          if (o instanceof Crate) {
            if (((Crate) o).getRectangle().intersects(rect)) {
              location = new Point(location.row - 1, location.col);
              rect = new FireRingRectangle(location.col - 25,
                  location.row - 25);
              moveable = false;
              return false;
            }
          }
          if (o instanceof FireRing) {
            if (o != this) {
              if (((FireRing) o).getRectangle().intersects(rect)) {
                location = new Point(location.row - 1,
                    location.col);
                rect = new FireRingRectangle(location.col - 25,
                    location.row - 25);
                moveable = false;
                return false;
              }
            }
          }

      }
      if (location.row > 665) {
        location = new Point(location.row - 1, location.col);
        rect = new FireRingRectangle(location.col - 25,
            location.row - 25);
        moveable = false;
        return false;
      }
      notifyObservers(this);
View Full Code Here

        g.drawImage(ibRect.getImage(), ibRect.xCoord(),
            ibRect.yCoord(), null);
      }
      if (p instanceof FireRing) {// for instance of fireRing
        FireRing fr = (FireRing) p;
        FireRingRectangle frRect = fr.getRectangle();
        g.setColor(frRect.setColor());
        g.drawImage(fr.getImage(), frRect.xCoord(), frRect.yCoord(),
            null);
      }
      if (p instanceof TNT) {// for instance of TNT
        TNT tnt = (TNT) p;
        TNTRectangle tntRect = tnt.getRectangle();
View Full Code Here

TOP

Related Classes of rectangles.FireRingRectangle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.