import
java.awt.Graphics 2D;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.imageio.ImageIO;
import main.GamePanel;
public class TileManager {
GamePanel gp;
Tile[] tile;
int mapTileNum[][];
public TileManager(GamePanel gp) {
this.gp = gp;
tile = new Tile[10];
mapTileNum = new int[gp.maxScreenCol] [gp.maxScreenRow];
getTileImage();
loadMap("/maps/worldmap.txt");
}
public void getTileImage() {
try {
tile[0] = new Tile();
tile[0].image = ImageIO.read(getClass().getResourceAsStream("/tiles/grass.png"));
tile[1] = new Tile();
tile[1].image = ImageIO.read(getClass().getResourceAsStream("/tiles/wall.png"));
tile[2] = new Tile();
tile[2].image = ImageIO.read(getClass().getResourceAsStream("/tiles/water.png"));
}catch(IOException e) {
e.printStackTrace();
}
}
public void loadMap(String filePath) {
try {
InputStream is = getClass().getResourceAsStream(filePath);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
int col = 0;
int row = 0;