To be clear, I hope in CGE to give you tools to deal with things in “lower level” when our “higher level” stuff is not enough.
For example, in How to render TCastleScene between two layers of Tiledmap? - #13 by michalis you found a problem with TCastleTiledMap, recorded as Tiled maps: Make it possible to render a character (any TCastleTransform) in a flexible way behind or in front of a layer with walls · Issue #440 · castle-engine/castle-engine · GitHub . I will fix it (though it is not trivial, so this one will not be done by tomorrow )…
… but in the meantime you have the option to make drawing yourself.
As much as I wanted to encourage using ready rendering of TCastleTiledMap , I admit that Tiled maps: Make it possible to render a character (any TCastleTransform) in a flexible way behind or in front of a layer with walls · Issue #440 · castle-engine/castle-engine · GitHub shows it is unsuitable in some cases (when you want to have a layer with walls). I didn’t predict this problem.
But you still have the option to draw map yourself using TDrawableImage
, using the information from TCastleTiledMapData
. These structures don’t go anywhere, and TDrawableImage
is optimal thanks to batching introduced last week. And you can take a look at src/scene/castletiledmap_control.inc
( castle-engine/src/scene/castletiledmap_control.inc at master · castle-engine/castle-engine · GitHub ), use this as a good starting point. If you insert character rendering in the middle of that code, than the walls will behave correctly.