Jump to content
  • Advertisement
Sign in to follow this  
Xadeu2005

C# Managed DirectX Timing Question

This topic is 4845 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

Hello all, How do I get a block to move once a second? I know this sounds trivial, but I am using Tom Miller's code from the Managed DirectX 9.0 Kickstart book. In the game "Dodger" he uses a class called Utility. I notice he uses updates his object's position based on elapsed time and the speed at which he wants the object to go. He does this to get a smooth flow...but I how do I slow the block down to only move every 1 second (1000 milliseconds)

Share this post


Link to post
Share on other sites
Advertisement
Hey folks,

I solved the problem.
The elapsedTime value was the elapsed time since the last frame.
I created a variable called cumulativeTime which added elapsedTime
to itself every frame. Once the cumulativeTime reached 1.0 I allowed
the block to update and then reset the cumulativeTime to 0.0f.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!