Need help loading different backgrounds
by Tony Te · in Torque Game Builder · 09/16/2009 (7:29 pm) · 4 replies
I'm fairly new to torque. I'm making a program right now and I want one of the features to be the user can choose which background they would like. I've looked over the forums and I've found some helpful guides but I'm at a stand still now. This is what I have right now and from reading over the references I believe I have to call addToScene to actually see the background but when I run the game I get a warning saying "Wrong number of arguments for addToScene" I'm sure that what I'm passing in isn't the right argument.
function class1::show(%this)
{
%bkgrd = new t2dStaticSprite() { scenegraph = t2dSceneGraph; };
%bkgrd.setPosition("0 0");
%bkgrd.setSize(100);
%bkgrd.setImageMap(Background_New_2ImageMap);
t2dSceneGraph::addToScene(%bkgrd);
}
#2
09/22/2009 (4:53 pm)
Thanks for the help but after changing the code it still wont show the image.
#3
09/22/2009 (7:48 pm)
I think your problem is that you need to specify which screengraph you are adding your object to. My code has something likemainWindow.getSceneGraph().add( %exitWindow );Where MainWindow is an object that already exists in in my scene.
#4
09/23/2009 (5:42 pm)
I've looked in the torque script wiki for the function add but i can't seem to find it.
Torque Owner Playboom Entertainment
with this:
%bkgrd.setImageMap("Background_New_2ImageMap", 0);