Game Development Community

Ordering images by code

by Bruno · in Torque Game Builder · 09/17/2009 (5:07 pm) · 3 replies

Hi,

I have 4 images, loaded and sorted correctly in the TGB Editor.
I need to change the rendering order of this images in realtime.
Is there a way, to change the order of rendering ?

thanks,
Bruno

#1
09/17/2009 (5:34 pm)
$yourt2dStaticSprite1.layer = 1;
$yourt2dStaticSprite2.layer = 2;
$yourt2dStaticSprite3.layer = 3;
$yourt2dStaticSprite4.layer = 4;

You can arrange the image's layer in an order that you need.
#2
09/17/2009 (5:48 pm)
Thanks, but that's not what i mean :)
I want to order them, like you do in the TGB Editor (with the front, back buttons).
You can order the rendering order of images in the same layer.
I don't want to change the layer of the images.
Is this possible ?

Thanks,
Bruno
#3
09/18/2009 (11:57 am)
Yep, that's possible.
YOURIMAGE.getScenegraph().setLayerDrawOrder(YOURIMAGE, "FRONT");

That would out your image to the front of current layer. Search tdn.garagegames.com for the rest of possibilities.