Hello,
I'm making a game with map tiles, and I need help specifying the coordinates.
I was using a method witch only colored rectangles, but I Switched to Images.
Inside the "public void paint(Graphics2D g)"
How I draw the map:Code://Set the tile to grass
Tile = Grass;
if (data[x][y] == BLOCKED) {
//If it's BLOCKED, draw Rock
Tile = Rock;
}
g.drawImage(Tile, null, null);
Inside the "public Map()"
and the data isCode:for (int y=0;y<HEIGHT;y++) {
data[0][y] = BLOCKED;
data[WIDTH-1][y] = BLOCKED;
}
for (int x=0;x<WIDTH;x++) {
data[x][0] = BLOCKED;
data[x][HEIGHT-1] = BLOCKED;
}
data[3][2] = BLOCKED;
data[3][3] = BLOCKED;
data[3][4] = BLOCKED;
data[4][3] = BLOCKED;
data[5][2] = BLOCKED;
data[5][3] = BLOCKED;
data[5][4] = BLOCKED;
when I run it, all I get is a tile on 0,0Code:private int[][] data = new int[WIDTH][HEIGHT];

