I am writing a game in which there are a number of lanes(). How I implement the z sorting at the moment is that I define a layer for each lane in tiled.
Below describes how each lane is defined in a level. let each x represent a tile, and each line of tiles represent a lane:
zindex1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zindex2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zindex3:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zindex4:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zindex5:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zindex6:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zindex7:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zindex8:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
zindexn:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
you can imagine the zsorting being much like that in double dragon with sprites being able to be sorted based on their y coordinate (http://www.intomobile.com/2011/02/11/aksys-games-reveals-updated-double-dragon-for-iphone-releasing-in-march/)
as the user navigates the map I insert him into the correct layer that is representative of the lane he is on. Based on a max/min y value. this is quite an optimal solution for depth sorting (in this game).
for lanes that have objects (like trees etc) i simply add further layers in tiled. one for foreground object, one for background objects. en example of an individual lanes layer setup:
backgroundLayer:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
middleLayer:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
foregroundLayer:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
So in our game there can be three layers for any given lane: a foreground layer, a middle layer for the player and a background layer, with the player always navigating between game lanes via the middle layers
What would be great is that we could set up depth sorting within a layer based on a sprites y value like in cocos2dx.
but even with y based sorting above solution is pretty optimal for our usage case as it is only really the player that changes its depth (all other sprites move exclusively in the x dimension). The problem lays with huge maps. In a map where i need to define 100+ lanes this can get pretty tedious to define all the layers within tiled. So what we need is the ability to add new layers on the fly via mte in the form of a new api function similar to
mte.addLayer(props)
thoughts?
/S