title: Movement issues, skipping fields
body: <p>I'm making a game, where you (the player) are represented by a number in a 2D matrix. The problem is that when I move the player, it skips fields, and does not respond very well. The movement is very inaccurate. If you could run the program, you could get a better understanding of the issue. How can I fix this problem? </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;windows.h&gt;
  #include &lt;time.h&gt;
  
  void delay(unsigned int mseconds)
  {
      clock_t goal = mseconds + clock();
      while (goal &gt; clock())
          ;
  }
  
  int map[5][5] = {{0, 0, 0, 0, 0},
                   {0, 0, 0, 0, 0},
                   {0, 0, 0, 0, 0},
                   {0, 0, 0, 0, 0},
                   {0, 0, 0, 0, 0}};
  
  int mUpdate(int x)
  {
      int i, j;
      for (i = 0; i &lt; 5; i++)
      {
          for (j = 0; j &lt; 5; j++)
          {
              printf("%d     ", map[i][j]);
          }
          printf("\n");
      }
  }
  
  int mRefresh(int x)
  {
      int i, j;
      for (i = 0; i &lt; 5; i++)
      {
          for (j = 0; j &lt; 5; j++)
          {
              if (map[i][j] &gt; 0)
              {
                  map[i][j] = 0;
              }
          }
      }
  }
  
  int main()
  {
      int c;
      int i, j;
      int p_num;
      printf("Hey! Choose a number from 1-9 that will represent you!: ");
      scanf("%d", &amp;p_num);
      printf("Choose a starting position by inputting two coordinates from 1-4!:  ");
      scanf("%d %d", &amp;i, &amp;j);
      printf("\nVery well, this is your starting position!\n");
      map[i][j] = p_num;
      mUpdate(map[i][j]);
      printf("\nYou are now the number %d !\n", p_num);
      printf("\nPlease wait for the map to load!");
      printf("\nMap loading will start soon!");
      delay(3000);
      for (c = 0; c &lt; 5; c++)
      {
          printf("\nLoading.");
          delay(500);
          system("cls");
          printf("\nLoading..");
          delay(500);
          system("cls");
          printf("\nLoading...");
          delay(500);
          system("cls");
      }
      printf("Map loaded!\n");
      printf("\nUse arrow keys to move thru the matrix!\n");
      mUpdate(map[i][j]);
  
      int game_running = true;
      while (game_running = true)
      {
          if (GetAsyncKeyState(VK_DOWN))
          {
              // delay(200);
              map[i++][j] = p_num;
              system("cls");
              mUpdate(map[i][j]);
              mRefresh(map[i][j]);
          }
          else if (GetAsyncKeyState(VK_UP))
          {
              // delay(200);
              map[i--][j] = p_num;
              system("cls");
              mUpdate(map[i][j]);
              mRefresh(map[i][j]);
          }
          else if (GetAsyncKeyState(VK_RIGHT))
          {
              // delay(1000);
              map[i][j++] = p_num;
              system("cls");
              mUpdate(map[i][j]);
              mRefresh(map[i][j]);
          }
          else if (GetAsyncKeyState(VK_LEFT))
          {
              // delay(200);
              map[i][j--] = p_num;
              system("cls");
              mUpdate(map[i][j]);
              mRefresh(map[i][j]);
          }
      }
      system("cls");
  }
  </code></pre>