Previously on "how to make an isometric game engine". Confusion ensued as guy floated over some shrubberies, instead of being between the bushes as laws of physics demand. And now, the conclusion. To that one problem.
Think about what the correct drawing order should be. I claimed before that it is to draw each row, starting from the back coming to the front, in the order as indicated in the picture below.
That does happen to draw the tiles in the correct order in the case of this tile engine, but generally what should happen is that things in the back get drawn before things in the front. And depth here depends on how high the tile appears on the screen. The red block is the highest, so it should be drawn first. Next are the yellow and green tiles. The violet block is lowest, so it is drawn last and appears in front of the others.
But wait a second. The yellow and green tiles were equally high. Doesn't that mean that we could actually draw them in either order? Yes, the opposite order works just the same:
This works for the movable characters too. We can put the guy and the tiles in the same list of things to draw on screen, then sort that list such that the highest item is drawn first, then proceed to draw them all. This way the drawing order will be correct. One exception is that if characters float or jump, that height should be added after sorting to maintain correct order.
When it is time to draw things, the difference between a tile and other graphical objects no longer matters. After the tiles have been moved from the tile array to the sorted display list, they are just the same. For the game logic it might still be convenient to have the array though, as it can be necessary to be aware of any special meaning of the tile the player is over, such as is walking through the tile possible.