title: C++ Game - Loop and KeyPress at the same time
body: <p>I made something like a game, you move your character(black box) up and down and there is a wall with some blank in middle of it, that wall is at right side, its coming from right to left side and if you touch the wall game ends.</p>
  
  <p>I get keypresses in a while loop like;</p>
  
  <pre><code>while(keyboardInput=getKeyPress()){
          switch(keyboardInput){/*checks the key and goes up or down*/}
          //draws the main character, then also draws the wall.
  }
  </code></pre>
  
  <p>and I made a wall() function, it prints blocks to make a wall.</p>
  
  <p>Problem is, the wall moves <strong>only</strong> after getting a keypress, my keypress function works with <strong>_getch()</strong></p>
  
  <p>The thing I want to see is, that wall will always move like every one second to left side even if user doesn't press any key, and key press/movement will work the same way.</p>
  
  <p>I put wall() function into the wall() function. It prints it just like I want but I cant get any keypress because that wall() <strong>loops forever</strong>.</p>
  
  <p><strong>Game looks like this:</strong></p>
  
  <pre><code>                                    *
                                      *
                                      *
                                      *
                                      *
  
  ■
  
                                      *
                                      *
                                      *
                                      *
                                      *
  </code></pre>
  
  <p>I am waiting for your answers, thank you!</p>