Depth Sorting in h2d.Layers with Added Sprite (heaps)

(Thomas J Webb) #1

I’m using h2d.CdbLevel (derived from h2d.Level) to load a map made in castledb and that works. I can also confirm loading a map I made with tall objects that depth sorting works right for the objects layer. However, I’m not sure how to add a sprite into it that gets properly depth-sorted. I see a ysort function on Layers and I see it getting called in the sync method on CdbLevel. I tried adding it as a separate layer and I’ve tried adding it as a child to the different layers. Do I need to setup my own depth-sorting that accommodates added sprites? You can see the code in its current state here:

(Thomas J Webb) #2

Setting the layer with trees and rocks to objects mode instead of tile mode fixed the issue (it’s set to tile mode in the aforementioned sample). Along with setting the dx, dy to the the bottom center of the tile I base the sprite on. These changes are reflected in the repo I linked to (nixie).