commit
a24e07f496
|
@ -13,6 +13,7 @@ import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -1,9 +1,27 @@
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class MapReader {
|
public class MapReader {
|
||||||
public static void inputMap(ArrayList<Tile> map, File file){
|
public static void inputMap(ArrayList<Tile> map, File file) throws FileNotFoundException {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
Scanner sc = new Scanner(new BufferedReader(new FileReader("src/Level1.txt")));
|
||||||
|
int rows = 7;
|
||||||
|
int columns = 7;
|
||||||
|
while(sc.hasNextLine()) {
|
||||||
|
for (int i=0; i<7; i++) {
|
||||||
|
String[] line = sc.nextLine().trim().split(" ");
|
||||||
|
for (int j=0; j<line.length; j++) {
|
||||||
|
map.add(new Tile(x,y));
|
||||||
|
x+=Tile.length;
|
||||||
|
}
|
||||||
|
x=0;
|
||||||
|
y+=Tile.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.awt.*;
|
||||||
public class Tile {
|
public class Tile {
|
||||||
public int x;
|
public int x;
|
||||||
public int y;
|
public int y;
|
||||||
public static final int length = 30;
|
public static final int length = 35;
|
||||||
public Tile(int x, int y){
|
public Tile(int x, int y){
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
|
Loading…
Reference in New Issue