making a console game and having a trouble with key input

i have made a simple ping pong game and i would like to make the panel to move when the key was pressed but the ball itself would wait a time period...

here's my code i have no idea on how to do this so i'm asking you

http://pastebin.com/raw.php?i=gBBGkQfv
Hello, it's always good to check if a key is hit. Use the following code:

1
2
3
4
5
6
7
8
9
10
11
12
if (kbhit())
{
    char key = getch();
    if (key == LEFT )
    {
        // Move left
    }
    else if (key == RIGHT)
    {
        // Move right
    }
}


kbhit() checks a memory buffer and tells if a button is hit. When you invoke getch() it will return you the char from the memory buffer and clear it. After that kbhit() will return false.
Last edited on
thank you it solved me that problem ^^ now i have different problem but i think i might be able to solve it myself
Great!
Topic archived. No new replies allowed.