Game Development Community

LoadLevel accidently overwritting existing levels...

by William Urban · in Torque Game Builder · 06/03/2007 (6:50 pm) · 1 replies

Hey guys,

So I'm running into this issue and I don't know if I am doing something wrong or if that is the default behavior. So in my game I have a function that loads the next level. When I do, this part works fine, the level loads and I can keep playing my game. The problem comes from testing it. So lets use this as an example. I have two levels. Level1 and Level2. When I open up the TGB level editor to work on my project I have Level1 up and visible. When I hit F5 to run the game, it drops me into level1. Then during this level my script runs and switches me to Level2. All fine and dandy no problem. When I exit out it drops me back to looking at Level1 but somewhere, somehow it thinks it's Level2. So if I hit save or anything like that what it does is take the existing Level1 I'm looking at but overwrites it onto Level2. So now Level2 and Level1 are identical. If I click Save as the default option is Level2 even though I'm looking at all the screen things of Level1. Its happened so many times now that I just comment out the level loading function unless I do a full build and run it from there. Am I doing something wrong or is this the default behavior when running the level editor and testing loading levels from within it?

Thanks,

-Will

#1
06/04/2007 (1:15 am)
I've noticed a problem with TGB keeping track of what level I am working on.

For instance if I am working on 'Level1.t2d' and I want to use it as a base for the next level, I saved Level1.t2d as Level2.t2d. (File + Save As...) So ideally I would be working on Level2 now, however if I do a save, (File + Save) it will still save to Level1.t2d.

The best way to get over this is to close TGB and start a fresh version with the level you want loaded, this will avoid saving over your levels by accident. Also - it is a good idea to backup your work always :)