# How to draw a character behind and in front of a building? (isometric map)

how is it possible to draw the player behind and in front of some building in an isometric map : should I slice them, replace the number in the map (one number for a tile usually) by an array of number (each being a piece of a bigger tile), and somehow add a Z-order related to each small number (the pieces of building), something like this?

//replace :
var map = [
[1,0,1],
[0,1,1],
[0,0,1],
[0,0,1]
];

//by :
var map = [
[["2-zOrder/1","3-zOrder/1"],0,1],
[1,1,1],
[1,0,1],
[0,0,1]
];


• How would you write the code in order to make it easy to manage. Is there a common way to make the "top" of a building appear in another tile, with a different Z value than the other tiles already in there? -> The bottom of the tile, the green square, would be in a tile, but the top of the building should be in another tile, with a different Z order, so that the player is hidden when he walks through the village. Is there a better way than an "array of array of array" with "zOrder/1"? Apr 15, 2017 at 6:45
• Give this a read: gamedevelopment.tutsplus.com/tutorials/… Apr 15, 2017 at 13:56
• Using depth map. Just it. May 21, 2017 at 17:35