Sign in to follow this  
Adam4444

Timer question (SDL)

Recommended Posts

I have made a simple tetris game and know I want to add some more functionality, among other things do so one can move the figure down faster. Right now I have a SDL_Timer which call a function every 600:ed millisecond. But when the down button is down I want it to reduce to 300:e milliseconds. How shall I do that?

Share this post


Link to post
Share on other sites
sounds like your just starting out.
might i recommend time based animation instead? then you can manipulate the speed of your game. e.g. if you want your entire game to slow by 50%, simply tell your update function that n/2 frames have passed, instead of n frames.

maintaining a constant framerate is awkward. I learned this the hard way.
very few games use a fixed frame rate, mainly because you can never be sure exactly how long one frame will take.

also, many more advanced options are available to you such as capping the framerate, which can save system resources substantially,. I usually cap my frames per second to 48, which means my laptop battery lasts alot faster when im running my game engine.


<n.b.> sorry, modified post because the first paragraph was confusing.

[Edited by - speciesUnknown on March 19, 2007 11:13:03 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this