refactor so that modifyTile is now directly accessible from Maps

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
Nic0Nic0Nii 3 years ago
parent d5fd02c7da
commit 0250b70a5d
  1. 6
      src/sig/RabiClone.java
  2. 6
      src/sig/map/Map.java
  3. 5
      src/sig/map/Maps.java

@ -47,13 +47,13 @@ public class RabiClone{
OBJ.add(new Player(p));
for (int i=0;i<12;i++) {
CURRENT_MAP.getMap().ModifyTile(0, i, Tile.WALL);
CURRENT_MAP.ModifyTile(0, i, Tile.WALL);
}
for (int i=0;i<36;i++) {
CURRENT_MAP.getMap().ModifyTile(i, 11, Tile.FLOOR);
CURRENT_MAP.ModifyTile(i, 11, Tile.FLOOR);
}
for (int i=0;i<10;i++) {
CURRENT_MAP.getMap().ModifyTile(i+5, 8, Tile.PLATFORM_LEDGE);
CURRENT_MAP.ModifyTile(i+5, 8, Tile.PLATFORM_LEDGE);
}
Map.SaveMap(CURRENT_MAP);

@ -36,8 +36,8 @@ public class Map {
try {
int marker=0;
DataOutputStream stream = new DataOutputStream(new FileOutputStream(map.getFile()));
while (marker<map.getMap().tiles.length) {
stream.writeChar(map.getMap().tiles[marker++]);
while (marker<map.map.tiles.length) {
stream.writeChar(map.map.tiles[marker++]);
}
stream.close();
} catch (IOException e) {
@ -46,7 +46,7 @@ public class Map {
}
public void ModifyTile(int x,int y,Tile t) {
tiles[y*MAP_WIDTH+x]=(char)(t.ordinal());
tiles[y*Map.MAP_WIDTH+x]=(char)(t.ordinal());
//System.out.println("Tile "+(y*MAP_WIDTH+x)+" is now "+tiles[y*MAP_WIDTH+x]+".");
}
}

@ -23,4 +23,9 @@ public enum Maps {
public Map getMap() {
return map;
}
public void ModifyTile(int x,int y,Tile t) {
map.ModifyTile(x, y, t);
//System.out.println("Tile "+(y*MAP_WIDTH+x)+" is now "+tiles[y*MAP_WIDTH+x]+".");
}
}

Loading…
Cancel
Save