Advertisement Jump to content
Sign in to follow this  

C# Managed DirectX Timing Question

This topic is 4911 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
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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!