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

            ibRect.yCoord(), null);
   
      }
      if(p instanceof FireRing) {
        FireRing fr = (FireRing)p;
        FireRingRectangle rect = fr.getRectangle();
        g.drawImage(fr.getImage(), rect.xCoord(),
            rect.yCoord(), null);
      }
     

      if (p instanceof TNT) {// for instance of TNT
        TNT tnt = (TNT) p;
        TNTRectangle tntRect = tnt.getRectangle();
        g.drawImage(tntRect.getImage(), tntRect.xCoord(),
            tntRect.yCoord(), null);
     
      }

    }
    for (PlayerTank p : tankList) {
      TankRectangle tRect = p.getRectangle();
      g.drawImage(p.getImage(), tRect.xCoord(), tRect.yCoord(), null);
    }
    for (EnemyTank p : enemyList) {
      TankRectangle tRect = p.getRectangle();
      g.drawImage(p.getImage(), tRect.xCoord(), tRect.yCoord(), null);
    }

    for (Projectile p : projectileList) {
      if (p instanceof PlayerProjectile) {
        PlayerProjectile s = (PlayerProjectile) p;
        ProjectileRectangle rect = s.getRectangle();
        g.drawImage(rect.getImage(), rect.xCoord(), rect.yCoord(), null);
      }
      if (p instanceof EnemyProjectile) {
        EnemyProjectile s = (EnemyProjectile) p;
        ProjectileRectangle rect = s.getRectangle();
        g.drawImage(rect.getImage(), rect.xCoord(), rect.yCoord(), null);
      }
    }
    for(int i = 0; i < model.getMap().getExplosions().size(); i++) {
      Explosion e = model.getMap().getExplosions().get(i);
      g.drawImage(e.getImage(), e.getLocation().col, e.getLocation().row, null);
View Full Code Here

        }
       
      }
      if (p instanceof FireRing) {// for instance of fireRing
        FireRing fr = (FireRing) p;
        FireRingRectangle tRect = fr.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof TNT) {// for instance of TNT
        TNT tnt = (TNT) p;
        TNTRectangle tRect = tnt.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
View Full Code Here

        }
       
      }
      if (p instanceof FireRing) {// for instance of fireRing
        FireRing fr = (FireRing) p;
        FireRingRectangle tRect = fr.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof TNT) {// for instance of TNT
        TNT tnt = (TNT) p;
        TNTRectangle tRect = tnt.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
View Full Code Here

        }
       
      }
      if (p instanceof FireRing) {// for instance of fireRing
        FireRing fr = (FireRing) p;
        FireRingRectangle tRect = fr.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof TNT) {// for instance of TNT
        TNT tnt = (TNT) p;
        TNTRectangle tRect = tnt.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
View Full Code Here

        }
       
      }
      if (p instanceof FireRing) {// for instance of fireRing
        FireRing fr = (FireRing) p;
        FireRingRectangle tRect = fr.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof TNT) {// for instance of TNT
        TNT tnt = (TNT) p;
        TNTRectangle tRect = tnt.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
View Full Code Here

        }
       
      }
      if (p instanceof FireRing) {// for instance of fireRing
        FireRing fr = (FireRing) p;
        FireRingRectangle tRect = fr.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof TNT) {// for instance of TNT
        TNT tnt = (TNT) p;
        TNTRectangle tRect = tnt.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
View Full Code Here

        }
       
      }
      if (p instanceof FireRing) {// for instance of fireRing
        FireRing fr = (FireRing) p;
        FireRingRectangle tRect = fr.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof TNT) {// for instance of TNT
        TNT tnt = (TNT) p;
        TNTRectangle tRect = tnt.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
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.