:o
That sounds complicated, I didn’t know rendering a tilemap would be such a nightmare to code.
I’ve got another idea but I don’t know if it would work. You told me a few days ago that if trees could be drawn as a single entity it would make the rendering order much easier.
But tiles can also be “grouped”. I can create TileGroup class that contains a list of tile ids and its relative positions to a root tile, then I add a new array of shorts in my tilemap which links to these TileGroup instances. That way I can get the root tile position and sort with it.
In comparator :
float y = drawable.getY();
if(drawable.isGroup) {
y = tileMap.findRootTileY(drawable.getGroupId(), drawable.getX(), drawable.getY());
}
What do you think ?