Friday, February 25, 2011

Isometric sorting flaw

I just realized there's a flaw in the way I was attempting to sort display objects in my isometric code. If the graphics of the tile is a thin wall to one side of the tile for example, then it's possible to walk so that it appears that the character is in front of the "wall", instead of behind.

This is because the tile graphics is just graphics to the engine. It doesn't understand that it implies some geometry to the viewer.

Works when wall-graphic tile is in (0, 1) and player is in tile (1, 1).



Fails when player is inside same tile (0, 1) and base of player is lower, so assumed nearer and sorted "wrong" (although depending on the graphics it could be right, for example if it's a picture of a tree instead of a wall).



I don't have a solution yet. More discussion about this issue on flashkit forums.