KDX

I'm trying to slow down my game with the code below :

protected override void Update(GameTime gameTime)
....
if (bNextTick(gameTime))
{
game.runState();
}
....

private Boolean bNextTick(GameTime gameTime)
{
curTime = gameTime.TotalRealTime.TotalMilliseconds;

if (curTime - timeNow > DELAY)
{
timeNow = curTime;
return true;
}
return false;
}


...........when DELAY is set to 13, there is no noticable difference, when set to 14 there is a significant slowdown. I cant seem to vary the slowdown between 13 and 14. Any ideas Are there better ways of slowing down the game


Re: XNA Game Studio Express Slowing down the game

WilderLand

what is your variable timeNow I don't see that set anywhere in the code above so I can't figure out what the loop is doing. When you say slow down your game, do you mean your animations, your frame rate





Re: XNA Game Studio Express Slowing down the game

ProfEclipse

Why not just use Game.TargetElapsedTime and let the framework handle it for you





Re: XNA Game Studio Express Slowing down the game

KDX

How or where do i set this




Re: XNA Game Studio Express Slowing down the game

KDX

private double timeNow;

It just keeps track of the time and updatest he logic code once the DELAY time has elapsed.




Re: XNA Game Studio Express Slowing down the game

KDX

Ah found it :

this.TargetElapsedTime = TimeSpan.FromMilliseconds(25);