I am creating an 2d bird view tile game using the pixijs render framework. Like pokemon or oldtime zelda.
In those games you sometimes walk behind buildings where the tile would be drawn on top of the player.
I am using an multidimensional array for each tile properties. Where you can set ground level images and level on top of ground level images.
The 'z-index' can be changed.
Should I create an new property to flag it as an tile that can be on top of the player? Where all those tiles with that property are drawn on top of the player. But there is an possibility that you can climb/walk on the building and the player should than be drawn on top of the tiles.
You should take the following into consideration
- the game is an multiplayer game.
This could be an conflict if all the players/characters (the player,npc, cpu) are one layer and the tiles that can be drawn on top of the player are one layer. Because for example: one player is walking on top of the building and one is behind the building. You cant change the z-index of the player one lower. Because the player behind the building wil look like he is on top of it because the player is drawn on top of it by the changed z-index.
you can be drawn on top of the tile level (like walking om top of the building or mountain)
tiles can change (a building that is going to be destroyed for example) thus are not fixed
So how can I handle tiles on top of a player which can be also beneath one player but not the other?