Loading new levels
by John Lopez · in Torque Game Builder · 04/09/2007 (3:10 pm) · 3 replies
This sounds like such a trivial question, but I've searched through this forum and TDN for an answer, and I have yet to find one.
How does one change from one level to another?
I've tried each of the following to get from the main menu to the first level:
sceneWindow2D.loadLevel("~/data/levels/level1.t2d");
sceneWindow2D.loadLevel("~/data/levels/level1.t2d.dso");
sceneWindow2D.getSceneGraph().loadLevel("~/data/levels/level1.t2d");
sceneWindow2D.getSceneGraph().loadLevel("~/data/levels/level1.t2d.dso");
With all of these, I just get a black screen, and on the console it says "Error loading level ~/data/levels/level1.t2d" or "Error loading level ~/data/levels/level1.t2d.dso"
I have to be doing something wrong... but I have no clue what it is.
How does one change from one level to another?
I've tried each of the following to get from the main menu to the first level:
sceneWindow2D.loadLevel("~/data/levels/level1.t2d");
sceneWindow2D.loadLevel("~/data/levels/level1.t2d.dso");
sceneWindow2D.getSceneGraph().loadLevel("~/data/levels/level1.t2d");
sceneWindow2D.getSceneGraph().loadLevel("~/data/levels/level1.t2d.dso");
With all of these, I just get a black screen, and on the console it says "Error loading level ~/data/levels/level1.t2d" or "Error loading level ~/data/levels/level1.t2d.dso"
I have to be doing something wrong... but I have no clue what it is.
#2
04/10/2007 (4:47 am)
That's what it was! I thought file functions automatically expanded the file name. Well, now I know. Thanks!
#3
the only problem I see is you do not have the full path to the level file.
You had it right on the money otherwise :-)
This will work through the console or simply as a standalone line of code in a function.
Example:
sceneWindow2D.loadLevel("tank_mp_test/data/levels/level1.t2d");
04/10/2007 (8:06 am)
John, the only problem I see is you do not have the full path to the level file.
You had it right on the money otherwise :-)
This will work through the console or simply as a standalone line of code in a function.
Example:
sceneWindow2D.loadLevel("tank_mp_test/data/levels/level1.t2d");
Torque Owner Tetraweb
%level=expandFilename("~/data/levels/level1.t2d"); if( isFile( %level ) || isFile( %level @ ".dso")) sceneWindow2D.loadLevel(%level);Greg