Problem with SetGameSpeed

Started by mode7, Fri 15/04/2011 09:18:52

Previous topic - Next topic

mode7

Hi Guys,
I'm trying to implent some kind of countdown in my game.
Therefore I calculate the time out of the game loops.

I set the game to 48 cycles/second. But my frames counter goes haywire. It jumps to 75fps when idle. Repeatedly setting it does not work. The problem is that my counter runs too fast even though I used GetGameSpeed.

Code: ags

time--;
hours = time/GetGameSpeed()/60/60;
minutes = time/GetGameSpeed()/60-(hours*60);
seconds = time/GetGameSpeed()-(minutes*60)-(hours*60*60);
lTime.Text= String.Format("Time: %d:%d:%d", hours, minutes, seconds);
}



Khris

I tried what you did; SetGameSpeed(48) and your code, exactly as you posted it.
I get a steady FPS of 50, and the counter runs down steadily and once per second.

If it still doesn't work for you you can use DateTime.RawTime to count seconds.

mode7

Thanks Khris, hm strange. It might have to do something with my engine...I have no idea what would cause this.
But thanks for the RawTime tip. This might work.

SMF spam blocked by CleanTalk