This topic is now archived and is closed to further replies.


VB 5.0 Timer / Animation Problem...

Recommended Posts

Zz    122
QUESTION: I am trying to insure my animation speed is the same on any computer I run my program on. Am trying to use a Timer control to do this but when I use a timer it is very slow. How can I keep my animation speeds constant on any computer? DISCUSSION: When I started writing my code I used a variable H to slow down my animation cycles of a large stone coming out the left side of the screen and reaching the center of the screen… While Z < 300 (300 was center) Screen.cls BitBlt ---- ,Z,--- screen.refresh For H = 1 to XXXX (XXXX was a number that I used to slow down in between cycles) Next H Next Z If the For H Loop was removed the animation would be near instantaneous of stone across screen. I knew that depending on your computer the XXXX would be to fast or to slow, so went to a timer control… Timer1_Timer() Z=Z+1 If Z <= 300 then Screen.cls BitBlt ---- ,Z,--- screen.refresh Else Timer1.Enabled = false End if End Sub I thought that this would allow me to control the speed by using the Timer1.Interval property but even when I set the Timer1.Interval = 1 it is very slow. Again, when I do not use Timer it is very fast. With the Timer it is to slow ?? I am only using Bitmaps although some are fairly large. Thanks for any help – Zz

Share this post

Link to post
Share on other sites
Julio    116
either lock the frame rate, or use frame-based modeling. if you want the animation to be slower than the fps rate, (very understandable) then you create another internal timer. this is c, but you basically do it like this:
int frame;
int timer;

while(!done) //game main loop


Share this post

Link to post
Share on other sites