Пример #1
0
  public void dropItems() {
    Iterator<TakeableItem> iter = inventory.getItems().iterator();
    while (iter.hasNext()) {
      TakeableItem item = iter.next();
      int xLoc = location.getX();
      int yLoc = location.getY() + 100;
      item.setLocation(new Location(xLoc, yLoc));
      item.setDisplay(true);
      iter.remove();
    }

    iter = equipment.getItems().iterator();
    while (iter.hasNext()) {
      TakeableItem item = iter.next();
      int xLoc = location.getX();
      int yLoc = location.getY() + 100;
      item.setLocation(new Location(xLoc, yLoc));
      item.setDisplay(true);
      iter.remove();
    }
  }
Пример #2
0
 public void equipItemAtIndex(int i) {
   if (inventory.getItemAtIndex(i).isEquippable())
     equipment.addItem(inventory.removeItemAtIndex(i));
   else System.out.println("That item isn't equippable!");
 }