Hey, I have an RPG engine which draws anywhere from 50 to 250 objects to the screen each cycle. It uses FBGFX (freebasic graphics lib.) My question is how can I control the game speed? What is the common way? Sleep 1 is not good. The speed fluctuates too much.
I have the following code now, and it somewhat works:
do
If Timer > t Then
t = Timer + .02
(get input)
(render graphics)
(put graphics to screen)
end if
loop
Is that a recommended way of doing things? It seems to work okay except I realize I'm putting a lot of graphics to the screen and it slows it down. But even if there's a normal amount of graphics put to the screen, I don't want to speed to fluctuate, (character walking fast and then slowing down).
I have the following code now, and it somewhat works:
do
If Timer > t Then
t = Timer + .02
(get input)
(render graphics)
(put graphics to screen)
end if
loop
Is that a recommended way of doing things? It seems to work okay except I realize I'm putting a lot of graphics to the screen and it slows it down. But even if there's a normal amount of graphics put to the screen, I don't want to speed to fluctuate, (character walking fast and then slowing down).
mrToad | dannywilfong.com | Alvarian Tales