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


Quirky User Input Problem...

Recommended Posts

Hello, I'm working on my first game for c++. It uses directdraw and works fine except I'm having trouble getting the player controls to work correctly. My pictures are setup via pixel arrays, and I use this function- if (KEYDOWN(VK_RIGHT)) { x += 10; } // end if to test if the player is trying to move. The x variable is then updated in my pixel array drawer that looks like this: for (int index = 0; index < 195; index++) { Draw_Pixel(x1[index] + x, y1[index] + 10 + y, rand()%256, (UCHAR *)ddsd.lpSurface, ddsd.lPitch); } // end However, in the game when I press a the right arrow key, my picture goes wacky and creates a large rectangle on the screen. All this is located in the Game Main, so if anyone has any ideas as to what I might be doing wrong, your input would be greatly appreciated... Thanks Oh yea, how do you clear the screen on a DirectX program? Edited by - webmunkey on July 23, 2001 12:40:27 AM

Share this post

Link to post
Share on other sites