   handling 2d movement
  Movement in my game is simplycase VK_RIGHT:    Move(fPositionX += g_fMoveSpeed, fPositionY, 0.0f);   g_Dir = 1;   g_Dir2 = 0;   nFrame = g_Dir2;....//-----------------------------------------------------------------------------// Name: Move(int x, int y, int z)// Desc: //-----------------------------------------------------------------------------int Move(float x, float y, float z){D3DXMatrixTranslation(&matTrans, x, y, z);sprite->SetTransform( &matTrans );return 0;}Basically it shows the correct frames while my character sprite is facing right and then translates it as I push the corresponding key. not too hard. However I want the movement in the game to be smooth, as in, when I hold down the right key it shouldn't increase by that small amount and then pause for a bit and THEN go smoothly if I hold it down. I want the character to be able to just be able to move in the direction I want, no pausing after the first initial movement. Here to hoping this made sense..I'll appreciate any isnight you can offer :)   
  The default keyboard driver is made for writing text so it is not suitablefor your example.You can base your read keyboard function on the GetAsyncKeyState() function for better results.   ;  pulpfist - to be honest I'm not quite sure what you mean by saying that i need to base my read keyboard function on GetAsyncKeyState(), can you give a quick example?I've spent a bit on these forums searching for "keyboard repeat delay" and other variations, and the solutions that have been offered suggest on the case WM_KEYDOWN setting a bool to true, but I'm not sure how that would actually fix the keyboard driver? I could be missing something, any insight is appreciated   ;  anybody? just some sample code that shows how to get past this is all i need ;)   ;  Yes, I have been having this same problem in my project. Could we get some help?   ;  cNoob gave me this, and it answered my question regarding a similar problem:#include <windows.h>#include <iostream>using namespace std;#define KeyDown(vk_code) ((GetAsyncKeyState(vk_code)&0x8000)?1:0)int main(){   while(1)   { if(KeyDown(VK_UP)) {   cout << "Up Was Pressed\n"; }  if(KeyDown(VK_DOWN)) {   cout << "Down Was Pressed\n"; }  if(KeyDown(VK_SPACE)) {   break; }   }return 0;};  That didn't fix the problem at all. :( BTW, if all you wanted to do was cout some text, that code would work perfectly.We are trying to do stuff with graphics.   ;Quote:Original post by bballmitchThat didn't fix the problem at all. :( BTW, if all you wanted to do was cout some text, that code would work perfectly.We are trying to do stuff with graphics.I believe he means to, instead of using whatever keyboard readers you are using, use GetAsyncKeyState, you should be able to google up a quic tutorial using that Keyreader and get something going quickly enough. He wasn't telling you to copy and paste, more of use the code in it and alter it to fit yours. There are many ways of checking which key is pressed, and the one the OP is using is apparently not very useful for graphics, but using GetAsyncKeyState RaccoonKing says will work better. I personally use the SDL way, so can't say for sure, but you would do something like this:#include <windows.h>#include <iostream>using namespace std;#define KeyDown(vk_code) ((GetAsyncKeyState(vk_code)&0x8000)?1:0)if(KeyDown(VK_UP)){DIR = 1;} else if(KeyDown(VK_DOWN)){DIR = 2;} else if(KeyDown(VK_LEFT)){DIR = 3;}else if(KeyDown(VK_RIGHT)){DIR = 4;}else{DIR = 0;}switch(DIR){    case 1: /*Move Up, Change charactor sprite to walking sprite, etc..*/ break;    case 2: /*Move Down, Change charactor sprite to walking sprite, etc..*/ break;    case 3: /*Move Left, Change charactor sprite to walking sprite, etc..*/ break;    case 4: /*Move Right, Change charactor sprite to walking sprite, etc..*/ break;    default: /*Don't move anywhere*/ break;}Again, you can't just copy and paste it. I'm sure you can find a decent tutorial somewhere with google, there might even be one on this site. But RaccoonKing's example should give you the neccesary knowledge, if you have any questions, people will gladly help, but you must ask a question, simply saying that it doesn't help, doesn't tell anyone what you have a problem understanding.   ;  That's the funniest post I've seen in a while bballmitch *wipes tear from eye*. I'm sorry, but I could see you actually scolding RacoonKing for giving you the correct answer.Your problem is you're using a WNDPROC to handle input which uses repeat and thus slows down your movement (and makes it stagger.) You need to move the code from the switch in your WNDPROC to few if statements like the RaccoonKing posted:if(GetAsyncKeyState(VK_RIGHT) & 0x08000)//move rightif(GetAsyncKeystate(VK_UP) & 0x08000)//move upetcRemember kids, to learn you must put forth SOME effort. Code dumps never help anyone =Þ.Rating++ for RacoonKing. You too Servant, especially for not doing a code dump [wink].   ;  OK, it works now. Thanks a lot. But there's one mroe problem. What if VK_UP and VK_DOWN are pressed at the same time? I want the character to move UP and DOWN. How do i handle this?[Edited by - bballmitch on May 15, 2006 12:30:25 AM]