Skip to main content
gamedev.net
🔒 Locked

Too fast input

Started by Mosselmaniac Jan 25, 2003 at 8:32 AM 0 replies 300+ views
Original Post
Mosselmaniac
Mosselmaniac
Hello all, i''m using DirectInput to read the keys that are pressed. My car race game is working fine, when you push the right arrow key the car is changing of his image, to the next frame. But, when you drive and you press the right arrow key button the car is turning too fast. You can make corners that are too sharp, do you understand me? My main game loop looks like: ''main game loop Do While bRunning lCounter = GetTickCount() - lStartTime If lCounter > lNewTime Then ''update game display Game_Update lCounter ''update frame count lNewTime = lCounter + 1000 / MAXFRAMERATE UpDown = False DownDown = False Keyboard.Check_Keyboard ''Checks which keys are pressed End If ''check for user input DoEvents Loop I want some kind of delay, but no mather what i try, nothing is working fine. Thanks in advance. Mosselmaniac
Vich
Vich
Do you use time based movement? Maybe that''s the problem?
The moving speed after rendering a frame should be like this:

movementUnits = definedSpeed * frameInterval

The movement units are is the distance you want to move. The defined speed is a (mostly) constant that you define and the frame interval is the time in milliseconds between the two last rendered frames.
[www.LifeIsDigital.net - My open source projects and articles.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.