Game Development Community

SceneWindow2D.loadLevel vs. sceneWindow2D.setSceneGraph(t2dScene

by Richard Foge · in Torque Game Builder · 05/21/2006 (3:00 am) · 4 replies

If I set up the standard:

// Create our scenegraph(s)
new t2dSceneGraph(t2dScene);

// Associate Scenegraph(s) with Window(s).
sceneWindow2D.setSceneGraph(t2dScene);

and then do:

sceneWindow2D.loadLevel(%level);

The value in t2dScene seems to somehow get wrecked. When I try to create objects later with:

%obj = new t2dStaticSprite(%spawnObj.name) { sceneGraph = t2dScene; };

%obj isn't properly associated with the scenegraph, if I remove the call to loadLevel everything works fine.

Anyone else seeing this? Anyone know any solutions?

Thanks!
Richard

#1
05/21/2006 (3:15 am)
Richard,
that's because sceneWindow2D.loadLevel() creates a new scenegraph for the loaded level. Use t2dScene.loadLevel() which should be what you want.
#2
05/21/2006 (3:34 am)
Awesome, thanks!

P.S. What the hell are you doing up so late? ;)
#3
05/21/2006 (4:23 am)
Glad I could help.

P.S. It's noon here in Central Europe.
#4
05/21/2006 (1:11 pm)
Erk, when I use t2dScene.loadLevel(%level) the level doesn't load up.

But it doesn't blitz t2dScene either, which is a step in the right direction :)

.loadLevel() seems to be pretty picky about when it wants to work. I get"

Loading compiled script testProject/data/levels/level01.t2d

but nothing shows up.