Tiles and Non-Tile Render Order
by Eric Armstrong · in Torque Game Builder · 03/03/2006 (6:10 pm) · 2 replies
I'm seeing some oddness in rendering tile layers and non tile layers. Perhaps I'm just not understanding the way the set layer works, but here is what I'm experiencing..
I have a t2dTileMap object with 9 tile layers in it. Each tile layer is set to a separate layer via a call to set layer. The layers are set from 0 to 8. I then have a custom brick object that is a subclass of t2dStaticSprite. This object is set to layer number 3. The issue I'm running into is that if I add tiles to the base tile layer which has its layer set to 0, by brick renders behind those tiles. In fact, it appears the only way I can get my brick to render in front of those base tiles is to put in the same layer as the base tile layer. In this case layer 0.
I was under the impression that objects in the scene would be rendered in layer order from lowest number to highest. I even tried reversing the order in which I numbered the layers, but the only way I can get the brick to render after the base tiles is to have it be in the same layer as those tiles.
If I'm misunderstanding something, please point me in the right direction. I can post the relevant creation code for all of the objects if needed also. Any assistance would be greatly appreciated, because I'm just not really understanding why this isn't working the way I'm thinking it should...
Thanks..
I have a t2dTileMap object with 9 tile layers in it. Each tile layer is set to a separate layer via a call to set layer. The layers are set from 0 to 8. I then have a custom brick object that is a subclass of t2dStaticSprite. This object is set to layer number 3. The issue I'm running into is that if I add tiles to the base tile layer which has its layer set to 0, by brick renders behind those tiles. In fact, it appears the only way I can get my brick to render in front of those base tiles is to put in the same layer as the base tile layer. In this case layer 0.
I was under the impression that objects in the scene would be rendered in layer order from lowest number to highest. I even tried reversing the order in which I numbered the layers, but the only way I can get the brick to render after the base tiles is to have it be in the same layer as those tiles.
If I'm misunderstanding something, please point me in the right direction. I can post the relevant creation code for all of the objects if needed also. Any assistance would be greatly appreciated, because I'm just not really understanding why this isn't working the way I'm thinking it should...
Thanks..
#2
03/04/2006 (10:19 am)
OK got it now... thanks for the clarification... I have everything working the way I wanted now...
Torque 3D Owner Stephen Zepp
Given an expectation/assumption that the player is never going to want to go "behind" a particular tile, it might make sense to move your tile layers from 0-9 to 10-19, and then your custom brick could be set to something like 5, guaranteeing it always renders in front of a tilemap layer (5 is always less than any of your tilemap layers).