Jump to content
  • Advertisement

Archived

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

branhield

writing a tetris clone

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

okay, im trying to write my own tetris clone. i guess im about 50% finished. now..i need to slow down the input so the block wont go from one side of the gamefield to the other at once i press the left or right arrow..until now, i have used a temporary solution: i limited the program to only take input every (frameCtr % 4 == 0)th frame. That works fine on my system, but on a 2ghz system blocks would still move extremely fast. So i need something that will work at the same speed on all systems..Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
Pseudo code

then = some_timer_function();

while( the_block_is_falling )
{
now = some_timer_function()
if( now - then > delay )
{
move_the_block_down;
then = now;
}
}


Depending on your OS, 'some_timer_function' may be gettimeofday(), timeGetTime() or something entirely different.

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]


[edited by - Fruny on November 9, 2002 12:17:05 PM]

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.

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!