Monthly Archives: August 2008

Paraplu: Ordered Layers!

Whoa, I just completed the ordered layer drawing system. Before, all Guys on a particular layer were drawn in whatever dang order the game pleased. This was fine in Soft Landing, because it had a purely side-on view and it was unlikely to matter which of any given pair of peers on a layer draws in front of the other. But Paraplu has a kind of hybrid top-down and side-on view, like A Link to the Past. So when two Guys overlap, it’s important for the one that’s higher up on the screen to appear behind the one that’s lower down.

Python made this pretty easy with its custom comparison functions for sorting. These ordered layers just use this loop for drawing:

for oneGuy in sorted(layer.sprites(), cmpY):

Instead of this one:

for oneGuy in layer.sprites():

And the cmpY function is just this:

return -cmp(a.rect.bottom, b.rect.bottom)

Super simple! Thanks, Python and Pygame!

Paraplu: Sequential dialog boxes

It was surprisingly tricky to create a system for a series of dialog boxes that appear one after another. Soft Landing’s novel part is based on conversation scripts for doing just that, but in Paraplu’s running-around-shooting-stuff engine, we didn’t really have any way of doing it. Now the game keeps track not just of whether there’s a dialog on screen to be dismissed, but also what kind of dialog it is, so that it knows whether to bring up another when that one is gone. Currently the only thing that uses this is the “workshop” where you can craft items into other items, but in the future we might want to be able to just load arbitrary lists of strings in there and set up long narratives.