a time delay system so you can see people walk

Started by
4 comments, last by ca_priest 21 years, 11 months ago
Im wondering how it appears people walk in a game. If i take 3 diffrent sprites and program them to move along the screen in a walking fasion, they move so fast you cant even tell that they''re walking, it looks more like they''re being teleported there. Im thinking some sort of time delay system should be used after each step so the player can actually see each individual step instead of a huge blur. Im thinking that from one tile to another, which would be about 4 redraws in my game, id like the entire process to complete in roughly 1 second maybe a bit less. The way it is now it completes in about a 10th of a second. If anyone knows of any functions or whatnot that can be used to delay redraws for a custom time period, please let me know. Any help or advice is appreciated.
...and that's where I saw the leprechaun...he told me to burn things.
Advertisement
If the system allows / is capable, use a high-resolution timer (otherwise low-res. ;L). Check out the many useful articles, here (on gamedev.net) and the many scattered across the .net Here is a link to a nice tut. http://www.gamedev.net/reference/articles/article753.asp
masterghttp:/masterg.andyc.org
You can define a speed for the player and then calculate it''s position from the time passed. Then, your player movement will be independent from the FPS. Search the forums since I think this topic has been commented many, many, many times.
Thanks for the info guys, im looking into it now. Thanks again.
...and that's where I saw the leprechaun...he told me to burn things.
Well the article answered all my questions but one. It never explains how to access the pc''s timer in the first place, it just assumes you can. If i could access a timer in the computer the rest i can take from there. Any help on this is also appreciated.
...and that's where I saw the leprechaun...he told me to burn things.
it also sounds like you aren''t doing framerate independant motion.

on every loop do you do:

position = position + velocity

or do you do:

position = position + velocity * timeSinceLastLoop


i''m guessing the former if you don''t know how to access the timer. anyway don''t do the first, and don''t slow down your game loop. it''s really bad practice. there''ve been a bizillion threads on that very topic so i won''t reiterate here. if you''re curious use the forums search feature.

the funciton you want is: timeGetTime(); or getTickCount() they will return a millisecond value (though not to millisecond accuracy)

i believe you have access to that through windows.h though i could be wrong about that. it might be time.h or soemthing else. anyone? i''ve used it but i always forget exactly this type of information.

-me

This topic is closed to new replies.

Advertisement