kyleconroy/hawkthorne-journey — pull request #422 by NimbusBP1729 (2012-10-10 10:36:29+00:00)
Title: Two dim room z buffer

when you're moving around a room and say an npc is in front of you, we currently wouldn't draw it correctly. The npc can be drawn over you when it's technically behind. The code originally just draws non-foreground nodes(in arbitrary order), then it draws the player, then it draws "foreground" nodes(in arbitrary order). This doesn't work too well for floorspaces like the tavern or the studyroom, but it works perfectly for levels like hallway or the town.

As an example, place your pot down in the tavern, don't throw it. then walk through it. The scene isn't redrawn correctly. The following image shows the difference with an NPC in the room: http://i.imgur.com/wIUcM.png?1

I sort of fixed this problem when I implemented the blacksmith in my branch. Don't worry, this will be a separate pull request.

To determine how to redraw, the main thing is to get the bottom most point of an object to determine its location. Since sprites are drawn from the top left, this means I need the height. For a lot of nodes we already have height readily accessible, but I wanted to make sure that it was a standard for all drawn nodes.

This will work almost perfectly for the time being, the only real problem will be when we implement jumping in 2dimensional floorspaces. I'll have to massage the code a bit.