How to change the layer value of an imagemap?
by Matt Begg · in Torque Game Builder · 05/17/2006 (8:41 pm) · 4 replies
Hi there
I am just getting to grips with TGB - but having tried out the 1.02 version of T2D a while back and putting it away. I know shame.
So anyway...
I am looking to create a game where I would like to change the value of the rendering layer to toggle between showing and hiding an imagemap.
I am stumped - having search the source I see there is a setlayer() for the t2dscenegraph but nothing on the t2dimagemapdatablock.
I have set the layer value from the level builder but would like to switch out certain graphics.
Thanks
I am just getting to grips with TGB - but having tried out the 1.02 version of T2D a while back and putting it away. I know shame.
So anyway...
I am looking to create a game where I would like to change the value of the rendering layer to toggle between showing and hiding an imagemap.
I am stumped - having search the source I see there is a setlayer() for the t2dscenegraph but nothing on the t2dimagemapdatablock.
I have set the layer value from the level builder but would like to switch out certain graphics.
Thanks
#2
As you pointed out Alex I could also get setVisible() too instead of setLayer() - and that maybe the way I''ll go
05/17/2006 (11:16 pm)
Thanks for the quick reply, but isn't it just the way, when you ask for help you seem to then find the answer yourself. After creating the imagemap in the leveleditor, by giving the object a class (imageclass) I was able to call set layer on thatfunction imageclass::onLevelLoaded(%this, %scenegraph)
{
$image=%this;
}
function toggle()
{
if ($showing)
{
//if board is in view then hide it by setting layer to 30
$image.setLayer(31);
$showing=false;
}
else
{
//if board is hidden then show it by setting layer greater than the card table
$image.setLayer(28);
$showing=true;
}
}As you pointed out Alex I could also get setVisible() too instead of setLayer() - and that maybe the way I''ll go
#3
05/18/2006 (9:15 am)
There are only 31 layer slots so it's probably better to use setVisible() and save your layers in case you need them. but you figured out another way to do it which is good that's how you learn the game engine :-)
#4
05/18/2006 (10:05 am)
Thanks for the tip Alex - much appreciated :-)
Torque Owner Alex Rice
Default Studio Name