   frogger move
  I am making a frogger game and i am confused as to the speed on how the frogger object moves.I can make it move 32 px on every key press on a frame rate of 10ps. This is as close to real thing looking at current online versions..The objects move separately on another thread so only the frogger moves at 10fps. Each row is 32 px in height so this is best. However the key response is slow as sometimes the frog doesnt move instantly.I had a look at other games for how it moves and I cant be right but I am close.If I have a higher frame rate then frogger object moves quickly and it can appear to move 64px on 1 keypress?How can i make this think move instantly on a key press and move 32px per move?   
  You could look into frame-rate independent movement. The idea is that every frame you calculate the time delta between the current frame and the last one.Say if you want to move 32 pixels per second, every frame you calculate: 32 / (1000 / delta), which gives you the number of pixels moved. This way the frame rate can vary, but the player's movement will always be constant.E.g. if the delta is 250 ms (a *long* frame, but anyway), you move the player 32 / (1000 / 250) = 8 pixels.Is that any help?   ;  Making the player actions be time dependant rather than key press dependant is the way to go.  I haven't played frogger in a while so I don't remember the extact player user interface.  If you press and hold a key on the keyboard, should the frog continue to jump?  Or should it only jump once and then the user must let off the key and press it again?If you are doing option #2 then you'll want to trigger your "frog move" event when the key is pressed and wait until the KEYUP message is received before you allow for another frog move event to happen   ;  Moving to Game Programming. :)   ;  u need to dobool moveup = false;int time = -1;if ( upkey_pressed ){  moveup = true;  time = now();}if ( upkey_held ){ if ( now() > time+200msec )  moveup = true;}if ( moveup ) then do the actual move;  how do i detect if the upkey is held down ?I can detect if the up  key is pressed but how do i detect if it is held down with c#?   ;Quote:Original post by jagguy2how do i detect if the upkey is held down ?I can detect if the up  key is pressed but how do i detect if it is held down with c#?You don't have to, you can store the state of the keys you are interested in yourself, when your app detects that a key is being pressed you set the keys flag to true, and when you detect that it is released you set the flag to false.(I assume that you are using the KeyDown event to detect when the user presses a key, the KeyUp event works the same way and lets you know when a key is released)   