Game Development Community

What's the level, Kenneth?

by Zilla · in Torque X 2D · 06/12/2008 (1:44 pm) · 5 replies

What is the easiest way to determine which level is loaded, so that I can trigger the actions in the code:

e.g.
if level==1 then do this
if level==2 then do that

#1
06/12/2008 (2:09 pm)
I cannot help, I only know what the frequency is. :(
#2
06/13/2008 (10:48 am)
SceneLoader.LastLoadedScene?
#3
06/13/2008 (12:05 pm)
Where is this documented?
#4
06/13/2008 (3:07 pm)
I'll check the scene loader code to see if there's a property that exposes the filename, but I really doubt that there is one. It seems to me that it would be easier to track that in your Game class. Add a property, like: public int CurrentLevel = 1; Then, each time you load a new level, increment this property. Then, anywhere you need to check you can do something like: if( Game.Instance.CurrentLevel == 1 ).

John K.
#5
06/19/2008 (4:30 am)
Quote:Add a property, like: public int CurrentLevel = 1

Thank you, John.