Ejemplo n.º 1
0
  public static void init(SpriteSheet sheet) {
    spritesheet = sheet;
    // Initialize Tile type Dictionary
    tileTypes = new HashMap<Integer, Tile>();

    // Initialize Tile name Dictionaries
    tileNames = new HashMap<String, Integer>();

    // Initialize Tile types
    try {
      fog = new Fog(FOG, "fog", sheet.getCustomTileTexture(5, 6, 5, 3));
      addTile(new Tile(AIR, "air"));
      addTile(new Tile(NULL, "null", sheet.getTileTexture(9 * sheet.width)));
      addTile(new DirtTile(DIRT, "dirt", sheet.getCustomTileTexture(0, 0, 5, 3)));
      addTile(new MultitextureTile(GRASS, "grass", sheet.getCustomTileTexture(1, 9, 3, 1)));
      addTile(new LakeTile(LAKE, "lake", sheet.getCustomTileTexture(10, 3, 5, 3)));
      addTile(new SandTile(SAND, "sand", sheet.getCustomTileTexture(10, 0, 5, 3)));
      addTile(new RoadTile(COBBLESTONE_ROAD, "road", sheet.getCustomTileTexture(5, 0, 5, 3)));
      addTile(
          new SnowyGrassTile(SNOWY_GRASS, "snowy grass", sheet.getCustomTileTexture(0, 6, 5, 3)));
      addTile(
          new FrozenLakeTile(LAKE_FROZEN, "frozen lake", sheet.getCustomTileTexture(5, 3, 3, 3)));

      addTile(new MultitextureForegroundTile(TREE, "tree", sheet.getCustomTileTexture(4, 9, 2, 1)));
      addTile(new MultitextureForegroundTile(BUSH, "bush", sheet.getCustomTileTexture(6, 9, 1, 1)));
      addTile(new MultitextureForegroundTile(SIGN, "sign", sheet.getCustomTileTexture(7, 9, 3, 1)));
      addTile(
          new MultitextureForegroundTile(ROCK, "rock", sheet.getCustomTileTexture(11, 9, 1, 1)));
      addTile(new MountainTile(MOUNTAIN, "mountain", sheet.getCustomTileTexture(0, 3, 5, 3)));
      addTile(new PotTile(POT, "pot", sheet.getTileTexture(0 + 10 * sheet.width)));
      addTile(
          new BrokenPotTile(BROKEN_POT, "broken_pot", sheet.getTileTexture(1 + 10 * sheet.width)));
    } catch (IOException ex) {
      Sys.alert("TileLand", "Unable to load tiletypes!");
      MenuManager.getMenuManager().openMenu("mainmenu");
    }
  }