kivent icon indicating copy to clipboard operation
kivent copied to clipboard

No clear way to sprite z sort

Open spinningD20 opened this issue 7 years ago • 4 comments

Specific to my situation (using a Tiled map), I'd love to have sprites in a layer that can be z ordered based on their Y positioning. If this can't be done without heavy workaround, is it in the plans for the future?

spinningD20 avatar Feb 28 '17 02:02 spinningD20

@spinningD20 I guess it's a very specific use-case. Is it something like u have a player and u want to make it disappear (or appear) as the player moves along the y-direction ?

saqib1707 avatar Feb 28 '17 09:02 saqib1707

http://www.cocos2d-x.org/wiki/TileMap#Using-multiple-TMX-Layers-and-z-order

See the example image underneath that section, that's what I'm after

spinningD20 avatar Feb 28 '17 10:02 spinningD20

@spinningD20 I had talked to @Kovak about this when I first started implementing layers in the maps module. Currently, the way to add z-index is to create multiple systems and place them in correct order, and let kivy handle the overlapping. This is what is being done in the init_map_systems right now.

I think having a z-index param in the renderer would need rethinking of the batching code and maybe something more.

EDIT: One more problem would be that you wouldn't be able to combine sprites and coloured polygons to get something like sprite-poly-sprite, because they require different systems.

udiboy1209 avatar Mar 01 '17 00:03 udiboy1209

+1 For having the ability to manage order in rendering sprites.

sireliah avatar Apr 09 '17 14:04 sireliah