Game Development Community

Level Loading

by Alexander Loren · in Torque Game Engine · 02/13/2004 (11:13 am) · 2 replies

I have recently been working on creating a small single player game with using the base scripts only as a referance. I have come to a small blockade when it comes to loading the level.

I am needing the level to begin loading when a button is pushed on the main menu, I have seen a script like this before but I am not able to find it again. Below is the code I have now. It is nothing more then the code taken from the FPS folder with a line or two removed. If someone where to help me with getting this to work how I've described above, that would be greatly appericiated. Thank you in advance for your help.

function loadLevel(%mission)
{
    %serverType = "SinglePlayer";
    createServer(%serverType, %mission);
    %conn = new GameConnection(ServerConnection);
    RootGroup.add(ServerConnection);
    %conn.connectLocal();
}

#1
02/13/2004 (11:39 am)
Go to the GUI editor(F10).
In the button's command field, try typing this :
loadLevel(expandFilename("./data/missions/test1.mis"));

Then that *should* load the "test1.mis" level as soon as you press the button.
#2
02/13/2004 (11:59 am)
Okey, I added that to the button. Though when I click on it I get an error from a .cc file saying that it could not create the bitmap array, and then the program causes an illegal operation and closes.