Package rectangles

Examples of rectangles.BubbleShieldRectangle


        g.drawImage(tRect.getImage(), tRect.xCoord(), tRect.yCoord(),
            null);
      }
      if (p instanceof BubbleShield) {
        BubbleShield s = (BubbleShield) p;
        BubbleShieldRectangle tRect = s.getRectangle();
        g.drawImage(tRect.getImage(), tRect.xCoord(), tRect.yCoord(),
            null);
      }
    }
    for (int i = 0; i < obstacleList.size(); i++) {
      Obstacle p = obstacleList.get(i);

      if (p instanceof Crate) {// for instance of crate
        Crate c = (Crate) p;
        CrateRectangle cRect = c.getRectangle();
        g.drawImage(cRect.getImage(), cRect.xCoord(), cRect.yCoord(),
            null);
      }
      if (p instanceof ImmovableBlock) {// for instance of immovableBlock
        ImmovableBlock ib = (ImmovableBlock) p;
        ImmovableBlockRectangle ibRect = ib.getRectangle();
        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();
        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 (Explosion p : explosionList) {
      g.drawImage(p.getImage(), p.getLocation().col, p.getLocation().row,
          null);
    }

    if (won == true) {
      Font font = new Font("Times New Roman", Font.BOLD, 28);
      String jb = "Mission Complete!";
      AttributedString att = new AttributedString(jb);
      att.addAttribute(TextAttribute.FOREGROUND, Color.YELLOW);
      att.addAttribute(TextAttribute.FONT, font);
      g.drawString(att.getIterator(), 400, 350);
    }
    if (lost == true) {
      Font font = new Font("Times New Roman", Font.BOLD, 28);
      String jb = "Mission Failed!";
      AttributedString att = new AttributedString(jb);
      att.addAttribute(TextAttribute.FOREGROUND, Color.RED);
      att.addAttribute(TextAttribute.FONT, font);
      g.drawString(att.getIterator(), 400, 350);
    }
    if (gameOver == true) {
      Font font = new Font("Times New Roman", Font.BOLD, 44);
      String jb = "Game Over!";
      AttributedString att = new AttributedString(jb);
      att.addAttribute(TextAttribute.FOREGROUND, Color.ORANGE);
      att.addAttribute(TextAttribute.FONT, font);
      g.drawString(att.getIterator(), 370, 350);
    }

    for (int i = 0; i < 700; i += 50) {
      for (int j = 985; j < 1200; j += 50) {
        if (i == 150 || i == 200 || i == 350 || i == 400) {
          g.drawImage(steel, j, i, null);
        } else {
          g.drawImage(camo, j, i, null);
        }
      }
    }
    for (int i = 690; i < 900; i += 20) {
      for (int j = 0; j < 1200; j += 20) {

        g.drawImage(gold, j, i, null);

      }
    }
    for (int i = 0; i < 700; i += 20) {
      for (int j = 985; j < 1200; j += 20) {
        if (i == 0 || i == 680 || j == 985 || j == 1165) {
          g.drawImage(gold, j, i, null);
        }
      }
    }
    for (int i = 0; i < 900; i += 20) {
      for (int j = 1180; j < 1500; j += 20) {
        g.drawImage(gold, j, i, null);

      }
    }

    Font font = new Font("Times New Roman", Font.BOLD, 20);
    String lives = "Lives Remaning";
    AttributedString att = new AttributedString(lives);
    att.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
    att.addAttribute(TextAttribute.FONT, font);
    g.drawString(att.getIterator(), 1018, 44);

    for (int i = 0; i < MasterView.playerLives; i++) {
      for (int j = 0; j < MasterView.playerLives * 50; j += 55) {
        g.drawImage(wheel, 1005 + j, 65, null);
      }
    }
    String curr = "Current Level: " + currentMap.getLevelNumber();
    AttributedString att3 = new AttributedString(curr);
    att3.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
    att3.addAttribute(TextAttribute.FONT, font);
    g.drawString(att3.getIterator(), 1013, 300);

    String item = "Active Items";
    AttributedString att6 = new AttributedString(item);
    att6.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
    att6.addAttribute(TextAttribute.FONT, font);
    g.drawString(att6.getIterator(), 1030, 485);

    if (player.isActiveShield()) {
      g.drawImage(new BubbleShieldRectangle(-10, -10).getImage(), 1020,
          515, null);
    }
    if (player.isActiveBoost()) {
      g.drawImage(new SpeedBoostRectangle(-10, -10).getImage(), 1100,
          515, null);
View Full Code Here


     
    }
    for (Item p : item) {
      if(p instanceof BubbleShield) {
      BubbleShield s = (BubbleShield)p;
      BubbleShieldRectangle tRect = s.getRectangle();
      if(tRect.intersects(rect)) {
        return false;
      }
     
     
    }
      if(p instanceof SpeedBoost) {
        SpeedBoost s = (SpeedBoost)p;
        SpeedBoostRectangle tRect = s.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
     
    }
    for (int i = 0; i < obs.size(); i++) {
      Obstacle p = obs.get(i);
      if (p instanceof Crate) {// for instance of crate
        Crate c = (Crate) p;
        CrateRectangle tRect = c.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof ImmovableBlock) {// for instance of immovableBlock
        ImmovableBlock ib = (ImmovableBlock) p;
        ImmovableBlockRectangle tRect = ib.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof SpikePit) {// for instance of SpikePit
        SpikePit sp = (SpikePit) p;
        SpikePitRectangle tRect = sp.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      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

  private boolean spawnBubbleShield() {
    Random rnd = new Random();
    int x = rnd.nextInt(600) + 25;
    int y = rnd.nextInt(875) + 25;
    b = new BubbleShield(new Point(x, y));
    BubbleShieldRectangle rect = b.getRectangle();
    LinkedList<Obstacle> obs = map.getObstacles();
    LinkedList<PlayerTank> tank = map.getPlayers();
    LinkedList<Item> item = map.getItems();
    for (PlayerTank p : tank) {
      TankRectangle tRect = p.getRectangle();
View Full Code Here

    att6.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
    att6.addAttribute(TextAttribute.FONT, font);
    g.drawString(att6.getIterator(), 1030, 485);

    if (player.isActiveShield()) {
      g.drawImage(new BubbleShieldRectangle(-10, -10).getImage(), 1020,
          515, null);
    }
    if (player.isActiveBoost()) {
      g.drawImage(new SpeedBoostRectangle(-10, -10).getImage(), 1100,
          515, null);
View Full Code Here

   * @param p
   *            the location that the BubbleShield instance is to be placed.
   */
  public BubbleShield(Point p) {
    location = p;
    rect = new BubbleShieldRectangle(location.col - 25, location.row - 25);
   
  }
View Full Code Here

     
    }
    for (Item p : item) {
      if(p instanceof BubbleShield) {
      BubbleShield s = (BubbleShield)p;
      BubbleShieldRectangle tRect = s.getRectangle();
      if(tRect.intersects(rect)) {
        return false;
      }
     
     
    }
      if(p instanceof SpeedBoost) {
        SpeedBoost s = (SpeedBoost)p;
        SpeedBoostRectangle tRect = s.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
     
    }
    for (int i = 0; i < obs.size(); i++) {
      Obstacle p = obs.get(i);
      if (p instanceof Crate) {// for instance of crate
        Crate c = (Crate) p;
        CrateRectangle tRect = c.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof ImmovableBlock) {// for instance of immovableBlock
        ImmovableBlock ib = (ImmovableBlock) p;
        ImmovableBlockRectangle tRect = ib.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      if (p instanceof SpikePit) {// for instance of SpikePit
        SpikePit sp = (SpikePit) p;
        SpikePitRectangle tRect = sp.getRectangle();
        if(tRect.intersects(rect)) {
          return false;
        }
       
      }
      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

  private boolean spawnBubbleShield() {
    Random rnd = new Random();
    int x = rnd.nextInt(600) + 25;
    int y = rnd.nextInt(875) + 25;
    b = new BubbleShield(new Point(x, y));
    BubbleShieldRectangle rect = b.getRectangle();
    LinkedList<Obstacle> obs = map.getObstacles();
    LinkedList<PlayerTank> tank = map.getPlayers();
    LinkedList<Item> item = map.getItems();
    for (PlayerTank p : tank) {
      TankRectangle tRect = p.getRectangle();
View Full Code Here

        g.drawImage(tRect.getImage(), tRect.xCoord(), tRect.yCoord(),
            null);
      }
      if (p instanceof BubbleShield) {
        BubbleShield s = (BubbleShield) p;
        BubbleShieldRectangle tRect = s.getRectangle();
        g.drawImage(tRect.getImage(), tRect.xCoord(), tRect.yCoord(),
            null);
      }
    }
    for (int i = 0; i < obstacleList.size(); i++) {
      Obstacle p = obstacleList.get(i);

      if (p instanceof Crate) {// for instance of crate
        Crate c = (Crate) p;
        CrateRectangle cRect = c.getRectangle();
        g.drawImage(cRect.getImage(), cRect.xCoord(), cRect.yCoord(),
            null);
      }
      if (p instanceof ImmovableBlock) {// for instance of immovableBlock
        ImmovableBlock ib = (ImmovableBlock) p;
        ImmovableBlockRectangle ibRect = ib.getRectangle();
        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();
        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 (Explosion p : explosionList) {
      g.drawImage(p.getImage(), p.getLocation().col, p.getLocation().row,
          null);
    }

    if (won == true) {
      Font font = new Font("Times New Roman", Font.BOLD, 28);
      String jb = "Mission Complete!";
      AttributedString att = new AttributedString(jb);
      att.addAttribute(TextAttribute.FOREGROUND, Color.YELLOW);
      att.addAttribute(TextAttribute.FONT, font);
      g.drawString(att.getIterator(), 400, 350);
    }
    if (lost == true) {
      Font font = new Font("Times New Roman", Font.BOLD, 28);
      String jb = "Mission Failed!";
      AttributedString att = new AttributedString(jb);
      att.addAttribute(TextAttribute.FOREGROUND, Color.RED);
      att.addAttribute(TextAttribute.FONT, font);
      g.drawString(att.getIterator(), 400, 350);
    }
    if (gameOver == true) {
      Font font = new Font("Times New Roman", Font.BOLD, 44);
      String jb = "Game Over!";
      AttributedString att = new AttributedString(jb);
      att.addAttribute(TextAttribute.FOREGROUND, Color.ORANGE);
      att.addAttribute(TextAttribute.FONT, font);
      g.drawString(att.getIterator(), 370, 350);
    }

    for (int i = 0; i < 700; i += 50) {
      for (int j = 985; j < 1200; j += 50) {
        if (i == 150 || i == 200 || i == 350 || i == 400) {
          g.drawImage(steel, j, i, null);
        } else {
          g.drawImage(camo, j, i, null);
        }
      }
    }
    for (int i = 690; i < 900; i += 20) {
      for (int j = 0; j < 1200; j += 20) {

        g.drawImage(gold, j, i, null);

      }
    }
    for (int i = 0; i < 700; i += 20) {
      for (int j = 985; j < 1200; j += 20) {
        if (i == 0 || i == 680 || j == 985 || j == 1165) {
          g.drawImage(gold, j, i, null);
        }
      }
    }
    for (int i = 0; i < 900; i += 20) {
      for (int j = 1180; j < 1500; j += 20) {
        g.drawImage(gold, j, i, null);

      }
    }

    Font font = new Font("Times New Roman", Font.BOLD, 20);
    String lives = "Lives Remaning";
    AttributedString att = new AttributedString(lives);
    att.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
    att.addAttribute(TextAttribute.FONT, font);
    g.drawString(att.getIterator(), 1018, 44);

    for (int i = 0; i < MasterView.playerLives; i++) {
      for (int j = 0; j < MasterView.playerLives * 50; j += 55) {
        g.drawImage(wheel, 1005 + j, 65, null);
      }
    }
    String curr = "Current Level: " + currentMap.getLevelNumber();
    AttributedString att3 = new AttributedString(curr);
    att3.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
    att3.addAttribute(TextAttribute.FONT, font);
    g.drawString(att3.getIterator(), 1013, 300);

    String item = "Active Items";
    AttributedString att6 = new AttributedString(item);
    att6.addAttribute(TextAttribute.FOREGROUND, Color.WHITE);
    att6.addAttribute(TextAttribute.FONT, font);
    g.drawString(att6.getIterator(), 1030, 485);

    if (player.isActiveShield()) {
      g.drawImage(new BubbleShieldRectangle(-10, -10).getImage(), 1020,
          515, null);
    }
    if (player.isActiveBoost()) {
      g.drawImage(new SpeedBoostRectangle(-10, -10).getImage(), 1100,
          515, null);
View Full Code Here

   * @param p
   *            the location that the BubbleShield instance is to be placed.
   */
  public BubbleShield(Point p) {
    location = p;
    rect = new BubbleShieldRectangle(location.col - 25, location.row - 25);
   
  }
View Full Code Here

TOP

Related Classes of rectangles.BubbleShieldRectangle

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.