Ejemplo n.º 1
0
 public static Level get(int layer, Player player) {
   Level level = loadedMaps.get(layer);
   if (level == null) {
     level =
         new Level(
             Art.load("/res/map/layer_" + layer + ".png"),
             Art.load("/res/map/items_" + layer + ".png"),
             player,
             layer);
     loadedMaps.put(layer, level);
   }
   return level;
 }
Ejemplo n.º 2
0
 public static void loadMap(int layer, Player player, RandomAccessFile loadfile)
     throws IOException {
   Level level =
       new Level(Art.load("/res/map/layer_" + layer + ".png"), null, player, layer, true);
   for (int x = 0; x < level.w; x++) {
     for (int y = 0; y < level.h; y++) {
       if (x == 0 && y == 0) {
         System.out.printf("Entering first tile at %d!\n", loadfile.getFilePointer());
       }
       Tile tileToSave = level.getTile(x, y);
       tileToSave.loadTile(loadfile);
     }
   }
   level.init();
   loadedMaps.put(layer, level);
 }