Transparency and drawing order


I’m working on a little project with tile maps and so far I’ve used different Z coordinates to make sure all tile layers and the player character get displayed correctly(player in front, map tiles in the back etc.). Today I changed the Pipeline by adding the “with_transparency(…)” method in order to get rid of ugly borders around sprites, as mentioned in the Amethyst book.

The problem is, now with transparency enabled the engine seemingly ignores the Z coordinates of all entities for the drawing order. After a long session where I tried all kinds of changes I finally figured out that with transparency enabled the drawing order is now only determined by the order in which I load the spritesheets from the .png and .ron files.

I somehow doubt this is the way it’s supposed to behave, but maybe I missed a different option - is there a “right way” to do this, without relying on the sprite loading order? So far I just add the sprites as entities(with a few additional components) like in the examples.


(Gray Olson) #2

You should also add a .with_sprite_visibility_sorting()

1 Like