Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/GamePanel.java
master
John 2022-06-02 14:50:07 -04:00
commit a24e07f496
3 changed files with 21 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.imageio.ImageIO;
import java.util.ArrayList;

View File

@ -1,9 +1,27 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;
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 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;
}
}
}
}

View File

@ -4,7 +4,7 @@ import java.awt.*;
public class Tile {
public int x;
public int y;
public static final int length = 30;
public static final int length = 35;
public Tile(int x, int y){
this.x = x;
this.y = y;