这是一个愚蠢的问题。从playn中读取文件
你如何在游戏playn读取文件?我尝试使用文件和扫描仪像我通常做一个标准的Java程序:
void readFromFile(){
int x;
int y;
int pixel;
int[][] board;
try{
Scanner scan = new Scanner(new File(in));
x = scan.nextInt();
y = scan.nextInt();
pixel = scan.nextInt();
Point start = new Point(scan.nextInt(), scan.nextInt());
Point dir = new Point(scan.nextInt(), scan.nextInt());
Point end = new Point(scan.nextInt(), scan.nextInt());
int antRoads = scan.nextInt();
board = new int[x][y];
for (int i = 0; i < y; i++){
for (int j = 0; j < x; j++){
board[i][j] = scan.nextInt();
}
}
lev = new Level(board, start, dir, end, antRoads, pixel, x, y);
} catch(FileNotFoundException e){
System.out.println(e);
}
}
我测试File.canRead(),canWrite(),并可以执行(),它们都返回false。
我应该使用assetMannager()。gettext的()的东西?如果是这种情况,有人可以告诉我它是如何工作的? (或者是什么,ResourceCallback是如何工作的?)
我的目标是有一个文件夹命名充满了常规的文本格式,就像标准的图像文件夹中的地图“地图”。
问候, Torgeir