Passages through isometric tiles
Above are four images of a character walk开发者_JAVA技巧ing along the ground from the bottom right towards the upper left. You can see that the drawing order isn't correct in the third panel.
There doesn't seem to be a "correct order" here. For example if instead of a small guy we had a sprite of a looooong cat going through the door, then no matter if you draw the door first or the cat first, it would be wrong.
How do other game engines handle this? Some hack to prevent this situation from happening? Draw a z-buffer by hand? Some other option that didn't occur to me?
The trick is simply to split the tile into pieces. Draw the right half of the arch, then the character, and then the left half.
An alternative to splitting the tile is to just render everything with z-values and a z-buffer like a proper 3d app would. If you generate your graphics in a 3D package you can probably generate the relative z values at the same time.
精彩评论