I recently watched a video on how to do tilemaps in java. He has the tiles as colored rectangles. I want them to be images.
My code:
public void draw(Graphics g){
for(int row = 0; row < mapheight; row++){
for(int col = 0; col < mapwidth; col++){
int rc = map[row][col];
if(rc == 0){
g.setColor(Color.green);
}
if(rc == 1){
g.setColor(Color.yellow);
}
g.fillRect(x + col * tilesize, y + row * tilesize,tilesize,tilesize);
}
}
}
This is the tilemap class. It says if rc is = to 0 it sets the color to green. Is there any way I can change that to an image?