Game Development Community

Loading level 2?

by Denis Linardic · in Torque Game Builder · 10/19/2005 (5:25 pm) · 15 replies

Hi guys. I am playing with T2D and now I am trying to figure out how to load another scene, something like level 2. I search the forums and TDN but I guess i missed that part. Could you give me few pointers?

Thanks!

#1
10/19/2005 (6:11 pm)
T2D does not have explicit support for Levels or Missions so you have to script it: first unload all the resource that make up Level 1 and then load the resources that make up level 2.

Use exec() to load script files, gui files and datablocks, and use tilemap objects to load backgrounds and layers.
#2
10/20/2005 (6:30 am)
Ok, thanks I was thinking of doing something like that. Are you aware of Levels or TGE like mission support in T2D in future?
#3
10/20/2005 (9:50 am)
At IGC Josh Williams demo'd the Torque 2D scene editor that "Large Animal" studios contributed. It has a similiar setup to missions and the mission editor of TGE. I 'beleive' it'll be in 1.1 release though before you get your hopes up we should wait on official word with that :)
#4
10/20/2005 (11:06 am)
Thanks Matthew :) This is great news (if GG can confirm that) <---HINT, HINT ;)
#5
10/20/2005 (5:04 pm)
Wow that's great news! Is said Scene Editor available for 1.0.2 at all? I vaguely remember seeing a post about it but just searched the forums but can't find anything about it.
#6
10/20/2005 (8:46 pm)
Anyone who was luck enough to see the scene editor for T2D demo. I am curious how "scene" is related to "tilemap" if they are integrated at all- or if scene editor can load tilemaps?

thanks
#7
10/21/2005 (1:42 pm)
I'm actually working on a similar problem. Please keep us up to date on your progress. I will do likewise.
#8
10/21/2005 (4:04 pm)
Well I am still on the paper, I hope that this weekend I'll have time to dig into this.
I will post my results if that will help :)
#9
10/22/2005 (1:05 pm)
Ok this is quite easy to create. As usual I started this more complicated than it really is.
Now I have to clean the code a little bit...so one more question:

Is it possible to unload all ImageMap at once (not specifiying every one of them) ?

Now I work this way:

bgHills01ImageMap.delete();
bgHills02ImageMap.delete();
bgHills03ImageMap.delete();
bgHills04ImageMap.delete();
bgHills05ImageMap.delete();
...

Thanks Alex Rice and rest of you for help!!!
#10
10/22/2005 (5:26 pm)
Denis, glad you are having success with it. You can try deleteAllDatablocks() [edit: DeleteDatablocks() ] which I have not tried yet myself. Also for non-datablock objects you can add them into a SimGroup then delete the SimGroup which will delete all contained objects.
#11
10/23/2005 (4:29 am)
Where did you find about deleteAllDatablocks() ?
I am searching T2D Reference documentation but I can't find it. I also searched GG but still not able to find it.

Everything works great, I would just like to clean the code a little bit...(have to many lines=harder to read) ;)

Maybe I could go with complete scene deleting/reloading not just datablocks?

P.S. Thanks for your patience guys! ;)
#12
10/23/2005 (4:39 am)
DeleteAllDatablocks()? There's no such method or function anywhere in T2D.

--
Hans
#13
10/23/2005 (9:22 am)
Oops it's DeleteDatablocks() not DeleteAllDatablocks(). Be forwarned- T2D will probably crash when you call it. This is beyond the scope of my expertise though... you can find forum several threads about memory management in T2D , and how to free up memory of objects no longer in use.
#14
10/23/2005 (9:27 am)
DeleteDatablocks() is a Torquescript core function, not T2D specific. See this thread also
#15
10/23/2005 (10:57 am)
Thanks for the link Alex. I get the idea, now let's get to work ;)