title: Pacman Game - how to get pacman to move automatically
body: <p>I'm making a pacman game and at the moment my pacman is moving within the allowed coordinates of the map when I press the right, left, up or down arrow key. It is only moving when I hold the key down. I was wondering how I could do this so that he moves automatically on the key press until he hits the wall in the map, so that I don't need to hold the arrow down. </p>
  
  <p>This is</p>
  
  <pre><code>   if (e.KeyCode == Keys.Down)
          {
              if (coordinates[(pac.xPosition + 16) / 20, (pac.yPosition + 20) / 20].CellType == 'o'
                  || coordinates[(pac.xPosition + 16) / 20, (pac.yPosition + 20) / 20].CellType == 'd'
                  || coordinates[(pac.xPosition + 16) / 20, (pac.yPosition + 20) / 20].CellType == 'p')
              {
  
                 pac.setPacmanImage();
                  pac.setPacmanImageDown(currentMouthPosition);
                  checkBounds();
  
              }
  </code></pre>
  
  <p>The cell types o, p and d are the only cells he is allowed to move on within the map. These cells are being drawn within a textfile.</p>
  
  <p>Sorry if it is hard to understand what I am asking but I am sure it is a fairly simple explanation. </p>
  
  <p>Thank you in advance.</p>