Timeline / Clearing Level Data
by John Bura · in Torque X 2D · 07/12/2010 (10:49 am) · 2 replies
Hi Guys,
I'm having a problem with my timeline/Clearing the level Data at the end. I have a timeline setup with about 30 methods like this
I load this level Every time I load my level. However, there is a problem. I don't know how to clear the level data. If I exit the level before all of the timeline is setup and I reload the level, the timeline restarts AND continues to fire from the previous load. I'm setting up my game so that every time the player dies, the level restarts. I just need to have the timeline restart too.
Im not sure how to do this. I have experimented trying to put Game.Instance.Engine.GameTimeScale to 0 But I don't know how to do that.
Any help is always appreciated :)
I'm having a problem with my timeline/Clearing the level Data at the end. I have a timeline setup with about 30 methods like this
Game.Instance.Engine.GameTimeSchedule.Schedule(GetMillisecondsFromSeconds(0), InitializeGamePlay);
Game.Instance.Engine.GameTimeSchedule.Schedule(GetMillisecondsFromSeconds(5), FiveSeconds);
..etcI load this level Every time I load my level. However, there is a problem. I don't know how to clear the level data. If I exit the level before all of the timeline is setup and I reload the level, the timeline restarts AND continues to fire from the previous load. I'm setting up my game so that every time the player dies, the level restarts. I just need to have the timeline restart too.
Im not sure how to do this. I have experimented trying to put Game.Instance.Engine.GameTimeScale to 0 But I don't know how to do that.
Any help is always appreciated :)
#2
What's happening is that Im setting up the level and when I exit the GameTimeSchedule is not cleared. I have tried but can't seem to find a way to do that.
Thanks :)
**Solved** 10 hours LOL
07/13/2010 (8:39 am)
Man Ive probably spent a good 8 hours on this problem and I haven't found any solution. What I need to do is clear the GameTimeSchedule. Does anybody know how to do that?What's happening is that Im setting up the level and when I exit the GameTimeSchedule is not cleared. I have tried but can't seem to find a way to do that.
Thanks :)
**Solved** 10 hours LOL
Torque Owner Cosmic Logic
First you would have to override XNA's update method. Every time the method calls it has the time since the last update as a parameter.
Just add this delta time to your game's time variable. Then make your timeline use that instead. When you want to reset, just set your time variable to 0.