Hi everyone,
I’m working on a tower defense project and i have the map already drawn in the screen. But now i’m having an issue when i place other images on top of the map tiles.
My painting algorithm is somethin like this one:
for(int i = 0; i < map.length; i++) {
for(int j = 0; j < map['i].length; i++) {
switch(map['i][j].type) {
case 0: draw normal tile.
case 1: draw route tile.
case 9: draw enemy image.
}
}
}
So i was expecting case 9 to be drawn in top of the other ones (case 0 and case 1) and it worked until i moved (updated) the enemy position into a route tile. Route tile was on top of the enemy image.
I want to mention that the map is being repainted in the game loop.
How can i achieve that the enemy image is on top of some tiles?
Thanks in advance!