Game Development Community

[Solved]I'm back! Problem with loading previous level...

by Vlad I · in Torque Game Builder · 03/30/2012 (7:09 am) · 3 replies

Hi all
I'm back!!! And I have a question regarding level scheduling.
How can you load the previous level?
I have something loading the next one. But I need to load the previous one when the conditions are met.
For the loading next level I have this which works:

SceneWindow2D.schedule(0, "loadLevel", "game/data/levels/level_" @ ($worldLevel + 1) @ ".t2d");

All levels are named Level_1.t2d, Level_2.t2d, Level_3.t2d etc..

Of coz I can specifically put:
SceneWindow2D.schedule(0, "loadLevel", "game/data/levels/level_2.t2d" );
after level 3 is complete. It works fine, but if I leave it like this after level_10.t2d it will load level_2.t2d and not level_9.t2d.

I've tried to change + for - and it resulted to black screen.
SceneWindow2D.schedule(0, "loadLevel", "game/data/levels/level_" @ ($worldLevel - 1) @ ".t2d");

What would be a feasible way to do it?
Thanks

#1
03/30/2012 (8:15 am)
ok I sorted it out changing + for - does work.
The reason it was giving me the black screen is that it was looking for level_0.t2d which I didnt have :)
#2
03/31/2012 (6:33 pm)
Hey Vlad! When's the game coming out?
#3
04/01/2012 (12:31 am)
Hey Patrick! The game is gonna come out in 4-5 months.
Actually the game was ready 6 months ago, but then I spoke to some people who made lots of this kind of games. They liked it and recommended me to include adventure elements to generate more sales.

I'll contact you by email soon, I have something I want to show you.