Ejemplo n.º 1
0
  /**
   * Adds the tile to the set, setting the id of the tile only if the current value of id is -1.
   *
   * @param t the tile to add
   * @return int The <b>local</b> id of the tile
   */
  public int addTile(Tile t) {
    if (t.getId() < 0) t.setId(tiles.size());

    if (tileDimensions.width < t.getWidth()) tileDimensions.width = t.getWidth();

    if (tileDimensions.height < t.getHeight()) tileDimensions.height = t.getHeight();

    tiles.add(t);
    t.setTileSet(this);

    return t.getId();
  }
Ejemplo n.º 2
0
 /**
  * This method takes a new Tile object as argument, and in addition to the functionality of <code>
  * addTile()</code>, sets the id of the tile to -1.
  *
  * @see TileSet#addTile(Tile)
  * @param t the new tile to add.
  */
 public void addNewTile(Tile t) {
   t.setId(-1);
   addTile(t);
 }