-fel
🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
I'm faster... so how can I... ??
![](http://www.gamedev.net/community/forums/ubb/smile.gif)
OK. this one is a lttle tricky
Im doing a fighting game but where the fighters have different speed, for ex. the speed can go through 1 to 10, if its 10 the fighter will perform a kick in .3 seconds and if it is 1 it will perform in 1.3 seconds.
How to implement this is the tricky stuff. I was thinking i could create a timer everytime the kick started and then kill the timer when it ended (Win32 timers) but i think this can be slow (i think the CreateTimer of the Win32 API is a little slow and not muhc accurate...
Any other thoughts about this ???
thks
Yours friend Akura
![](http://www.gamedev.net/community/forums/ubb/wink.gif)
Use high performance timers under windows to count game time, and assign a "delay" to each frame in the animation (To achieve faster or slower animations, multiply this by a speed factor e.g. 1.2 to get 20% increase in delay).
In you main render loop, check the time passed since last rendering and update your framecounter accordingly. I.e. if the next 4 frames in an animation has delays 12,17,14 and 20 ms, and the time passed is 31, you skip the first two frames, and timestamp the animation with 2 (31-(12+17)).
The trick is that because most animations run 12 or 25fps, while the game runs 40+, you rarely, if ever, have to skip more than one frame per refresh, yet you have the advantage of animating with almost ms accuracy.
/Niels