[SEMI-RESOLVED]reordering tiles z index - not being honored

I saw the TMXIsoZOrder example in TileMapTest.js unfortunately I think that’s a little inefficient to create your tmx map when you have to do it that way - that is, adding 100 layers for a complex and larger map.

but i had a quick solution, one layer would suffice, and in my code i would do something like this:

// reorder each tile’s z-order
for(var y = 0; y < ms.height; y++) {
for(var x = 0; x < ms.width; x++) {
var tile = objectLayer.tileAt(ccp(y,x))
// ensure there’s an object or wall
if( tile ) {
// add x and y this is equivalient to increasing the tile’s z-order row by row
objectLayer.reorderChild({child: tile, z: x + y})
}
}
}

then whenever my character moves, i change its zindex order based from its current tile x and y coordinates:

var objectLayer = this.tmxMap.getLayer({ name: ‘object’})
objectLayer.reorderChild({child: this, z: this.tileX + this.tileY})

this works flawless using the cocos2d-javascript port of cocos2d http://cocos2d-javascript.org

so I tried the same approach with this framework but the tile’s z index is never changed. I tried both using both cc.TMXTiledMap and cc.TMXLayer to reorder the tile but when my character moves, even if its z order is higher / lower than the tile, my character is not honoring the tile’s z index, its always showing in front.

EDIT:

This an example problem - http://d.pr/i/1Sng

See how the player is showing on top of the coffin (wrong) but infront of the wall (correct).

But the coffin’s z index is actually higher than the player and the wall’s z index lower than the player, but apparently they are not honored.

Would be great if someone can please suggest a solution that would not ask to create 100 layers in Tiled just to have a correct z-indexing.

for this to work - i had to comment out the addChild from the cc.TMXLayer - and add my sprites using it’s parent SpriteBatchNode addChild

That works and the z-index is now being honored.

The only problem is - it affects performance by about 40%! I see my FPS from a constant 58FPS dropped to 35FPS just by adding a single sprite.

Good thing though - adding over 100 sprites seems not to drop it drastically further. Just the first sprite.

Any thoughts?