# 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]
];


• You should add an image showing the end result that you're expecting. – Vaillancourt Apr 14 '17 at 19:59
• Or at least an image of what you have now and a description of what's undesirable about it. – Draco18s no longer trusts SE Apr 14 '17 at 20:26
• @AlexandreVaillancourt my question is : 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"? – Reign Ravel Apr 15 '17 at 6:45
• @Draco18s I added a comment above – Reign Ravel Apr 15 '17 at 6:46
• Give this a read: gamedevelopment.tutsplus.com/tutorials/… – Draco18s no longer trusts SE Apr 15 '17 at 13:56