}
private void loadSingleFile(String chunkName) {
try {
char[][] temp = new char[50][50];
Chunk tempChunk = new Chunk();
char[][] tempArray = new char[0][0];
// Open the file that is the first command line parameter
FileInputStream fstream = new FileInputStream("data/levels/"
+ chunkName + ".txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
// Read File Line By Line
while ((strLine = br.readLine()) != null) {
if (strLine.startsWith("<")) {
tempRow = 0;
// command
String[] tokens = strLine.split("[ ]+");
for (int i = 0; i < tokens.length; i++) {
String[] command = tokens[i].split(":");
if (command[0].equals("time")) { // time
// save time
} else if (command[0].equals("chunk")) {
int id = Integer.parseInt(command[1]); // chunk ID
// create chunk
tempChunk = new Chunk();
// save chunk ID
tempChunk.setID(id);
cm.add(id, tempChunk);
} else if (command[0].equals("size")) { // size
int row = Integer.parseInt(command[1]);
int col = Integer.parseInt(command[2]);
tempChunk.setChunk(row, col);
tempArray = tempChunk.getArray();
} else if (command[0].equals("anchor")) { // anchor
int aIn = Integer.parseInt(command[1]);
int aOut = Integer.parseInt(command[2]);
tempChunk.setAnchors(aIn, aOut);
} else if (command[0].equals("movNum")) { // movable
// number
int num = Integer.parseInt(command[1]);
tempChunk.setPlatformNum(num);
} else if (command[0].equals("mov")) { // movable
// platforms
int sx = Integer.parseInt(command[1]);
int ex = Integer.parseInt(command[2]);
int sy = Integer.parseInt(command[3]);
int ey = Integer.parseInt(command[4]);
tempChunk.setPlatform(sx, ex, sy, ey);
} else if (command[0].equals("numWH")){
int numW = Integer.parseInt(command[1]);
int numH = Integer.parseInt(command[2]);
tempChunk.platformWH(numW, numH);
} else if (command[0].equals("spawn")){
int spawnX = Integer.parseInt(command[1]);
int spawnY = Integer.parseInt(command[2]);
tempChunk.setSpawn(spawnX, spawnY);
}
}
} else {
// fill array