Exemplo n.º 1
0
 public World() {
   super(GAME_TITLE);
   _fileFilter = new FileNameExtensionFilter("Blockamon SAVE", "save");
   this.setLayout(new BorderLayout());
   inBattle = false;
   playingField = new JPanel(null);
   playingField.setBorder(BorderFactory.createLineBorder(Color.black));
   playingField.setPreferredSize(new Dimension(400, 300));
   worldSize = playingField.getPreferredSize();
 }
Exemplo n.º 2
0
  public void run() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    player = createPlayer();
    playingField.add(player);
    createItemShop();
    createHealingCenter();
    createGrass();
    menu =
        new ControlPanel(
            getPlayer(),
            createSaveWriter(_fileFilter),
            createSaveLoader(_fileFilter),
            getItemShop(),
            getHealingCenter(),
            new WindowDisplay());

    add(menu, BorderLayout.NORTH);
    add(playingField, BorderLayout.CENTER);
    pack();
    player.setVisible(true);
    this.addKeyListener(new KeyListen(this, menu));
    setVisible(true);
    this.repaint();
  }
Exemplo n.º 3
0
 private void createItemShop() {
   // creates the shop you can buy from
   itemShop = new ItemShop();
   itemShop.stockItems(Item.HEALVIAL, Item.BLOCKABALL);
   playingField.add(itemShop);
 }
Exemplo n.º 4
0
 // player loses a battle and all blockamon in their party have lost all HealthPoints
 public void playerWhitedOut() {
   player.setLocation(healingCenter.getX(), healingCenter.getY());
   player.healAllBlockamon();
   player.loseMoney();
   playingField.repaint();
 }
Exemplo n.º 5
0
 // creates the place that can heal
 private void createHealingCenter() {
   healingCenter = new HealingCenter();
   playingField.add(healingCenter);
   playingField.repaint();
 }
Exemplo n.º 6
0
 // creates grass
 private void createGrass() {
   // creates the grass where wild Blockamon live
   wildGrass = new Grass(0, 0, (int) (worldSize.width * .3), worldSize.height, this, menu);
   playingField.add(wildGrass);
 }