Why can't I change levels?
by Martin Bishop · in Torque Game Builder · 09/18/2006 (8:07 am) · 5 replies
I guess I'm having the same issue that Gordon C mentioned. I read that "startGame" is what you use to load a new level, but when I try to do this, it crashes every time. I need to know that I can change levels in my games before I buy the engine. Is there some other way to do so? I'm on XP Professional with v1.1.1 of T2D by the way.
#2
and it too causes a crash.
Based on the documentation for the t2dSceneGraph version of this same "loadLevel" method (as opposed to the t2dSceneWindow version), I've tried assigning a global variable to the original sceneWindow2D.loadLevel call within the startGame method (the one created by the engine, not by me). Based on the docs, this should assign the sceneGraph that the original level was loaded into to this global variable. When I try to use this global to call loadLevel, it too crashes.
So, if startGame doesn't work, and neither version of the loadLevel method works, what am I supposed to use?
09/18/2006 (8:55 am)
Thanks for your reply. Are you referring to the loadLevel method? I've tried this, using:sceneWindow2D.loadLevel("~/data/levels/mySecondLevel.t2d");and it too causes a crash.
Based on the documentation for the t2dSceneGraph version of this same "loadLevel" method (as opposed to the t2dSceneWindow version), I've tried assigning a global variable to the original sceneWindow2D.loadLevel call within the startGame method (the one created by the engine, not by me). Based on the docs, this should assign the sceneGraph that the original level was loaded into to this global variable. When I try to use this global to call loadLevel, it too crashes.
So, if startGame doesn't work, and neither version of the loadLevel method works, what am I supposed to use?
#3
http://www.garagegames.com/products/90
09/18/2006 (9:25 am)
TGB Adventure Kit has level changing and it does not cash. It outstanding product to buy and learn from to help you out in TGB.http://www.garagegames.com/products/90
#4
sceneWindow2D.schedule(1, "loadlevel", %level);
09/18/2006 (9:37 am)
You need to set a slight delay on loadLevel for it to work correctly. This is a bug / design flaw:sceneWindow2D.schedule(1, "loadlevel", %level);
#5
Brilliant! That did the trick. Thank you very much. I wonder why this isn't mentioned in any of the tutorials or the TGB reference? I've been pulling my hair out over it.
@Michael
Thanks. I've been drooling over the Adventure Kit for a while now. As soon as I have the spare cash, I'll be getting it.
09/18/2006 (10:24 am)
@NickBrilliant! That did the trick. Thank you very much. I wonder why this isn't mentioned in any of the tutorials or the TGB reference? I've been pulling my hair out over it.
@Michael
Thanks. I've been drooling over the Adventure Kit for a while now. As soon as I have the spare cash, I'll be getting it.
Torque Owner Stephen Howe