Simple Movement

So I've been making this game and its done actually but the problem is when I hold down a key it goes forward 1 then stops then continues.
I did it a bit like this:

1
2
3
4
5
6
7
8
9
10
if(kbhit())
{
   switch(getch())
   {
     case 100:"yada-yada"...
              break;
     case 97:"yada-yada"...
              break;
   }
}


My teacher said that it saves it (stops for a sec) then continues to move. But really that offered no solution to me... Or at least I could figure out... So why does it does this, and how can I prevent this?
Firstly, what on earth is that code meant to do? Second, switch cases should be written out in ascending order (lowest to highest). Third, post the code actually causing the problem.

Firstly, what on earth is that code meant to do? Second, switch cases should be written out in ascending order (lowest to highest). Third, post the code actually causing the problem.

Its meant to move. You press 'a' you go left your press 'd' you go right. Whenever you hold it down it moves one then stops for a sec and then continues moving.
Last edited on
That's because of the repeat. Like how you hold down they key 'd' in this text box there is a delay before it repeats.

That's because of the repeat. Like how you hold down they key 'd' in this text box there is a delay before it repeats.


Ok?... So it repeats once then saves it because your holding it down? Is there a solution? Obviously because I've seen other games move a lot finer than with that? If not "solution" then just some rewrite or different way to do it?
Topic archived. No new replies allowed.