Don't use GetTickCount, it has a very low resolution. QueryPerformanceCounter or timeGetTime are better.
Also, it is better to store positions, speeds etc. as floating-point (i.e. Single/Double) rather than integers.
Don't use GetTickCount, it has a very low resolution. QueryPerformanceCounter or timeGetTime are better.
Also, it is better to store positions, speeds etc. as floating-point (i.e. Single/Double) rather than integers.
[size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]
Been here myself so I know how confused you are, but it's a lot easier than you think.
You need to write some code to calculate how long it's been since the last frame and move everything based on that.
So if you want something to move at 100 pixels per second, work out how much time has gone by since the last frame and move your character by the appropriate amount.
Don't have access to it now, but if you want some example code, email me
thedamot@mailcan.com
Cheers,
Damot
Here is some source code:
http://www.cairnsgames.co.za/downloa.../barbarsrc.zip
Note however that the way this code works is that it waits until a set delay is complete before moving the sprite - ie it skips some frames if no movement is neccessary.
Look at the Draw functions in UnitBarBar and UnitItems.
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
Bookmarks