Package game.tower

Examples of game.tower.GunTower


  private Vector2f position;
 
  @Override
  public void doCommand() {
   
    GunTower gt = new GunTower(this.position.x, this.position.y, this.player);
   
    // Can the player allow it ?
    if(player.getBank().getMoney() > gt.getBuyingPrice()) {
     
      // we add the tower to the game
      Game.getInstance().getTowerManager().addTower(gt)

      if (this.player instanceof RealPlayer) {
        ((RealPlayer)this.player).setBuildingTower(false);
      }
     
     
      gt.setBorder(BorderFactory.createLineBorder(Color.black));
      gt.setContentAreaFilled(false);
      gt.setBounds((int)gt.getPosition().x, (int)gt.getPosition().y, 40, 40);
      gt.setOpaque(true);
      try
      {
        gt.setIcon(new ImageIcon(ImageIO.read(new File(Theme.pathImageTower))));
        gt.setBackground(Color.RED);
 
      }
      catch (IOException e1)
      {
        System.out.println(e1);
      }
     
      // we add the tower to the window
      AppliWindow.getInstance().getContent().add(gt);
      AppliWindow.getInstance().giveFocusToPanel();
     
      // we remove the money
      this.player.getBank().setMoney(this.player.getBank().getMoney() - gt.getBuyingPrice());
     
    } else {
      System.out.println("Out of Money sorry, poor !");
    }
  }
View Full Code Here

TOP

Related Classes of game.tower.GunTower

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.