Jump to content
  • Advertisement

Archived

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

foonk

acceleration...

This topic is 5968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey i''ve been thinking about how to make a object accelerate kind of like a car, would, and soon reliesed i would need to use a timer, so then if your computer is faster it wont speed the acceleration up, anyway i was wondering if you guys have any tips on doing this, or a good place to read up about timing in game etc. thanks for anything that help. m

Share this post


Link to post
Share on other sites
Advertisement
This is basically how timing works:

During initialization you save the current time.
lasttime = gettime();

Each frame you do this:
frametime = (currenttime = gettime()) - lasttime;
lasttime = currenttime;

You should of course use the best clock you have on the system, such as a high performance multimedia counter (timeGetTime in windows.)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!