I’m working on a class that’s supposed to load the level for my game from a text file. I’m getting one error and I’m wondering how I could fix it.
package waffles.main;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class DataLoader {
public String[][] Level = null;
public DataLoader(){
}
public void LoadLevel(String level){
try {
BufferedReader in = new BufferedReader(new FileReader("res/levels/" + level + ".lvl"));
String str;
int line = 0;
String readline[];
while ((str = in.readLine()) != null) {
readline = str.split(":");
ProcessData(readline, line);
line++;
}
in.close();
} catch (IOException e) {
System.out.println("Level " + level + " is missing!");
}
}
private void ProcessData(String str[], int line){
Level[line][0] = str[]; //Here is the error.
}
}
Any help please?