title: WPF suspending key presses for a slower movement
body: <p>In my game, my character is moving, but my problem is, that if I keep pressing the buttons he reaches supersonic speed and runs very fast. Which is not good.</p>
  
  <p>What do you suggest how to put a "wait" in the code to simulate a more realistic moving?</p>
  
  <p>I tried System.Threading.Thread.Sleep but it was a dead end. It suspended the whole program. And the enemies stopped.</p>
  
  <p>I'm using a DispatcherTImer in the program for the enemy moving maybe it is the solution but i wasn't able to figure out.</p>
  
  <p>I have this keydown event:</p>
  
  <pre><code>private void Window_KeyDown_1(object sender, KeyEventArgs e)
  {
      if (e.Key == Key.H)
      {
          //Jatek.Player.Hack();
      }
      else if (e.Key == Key.Up)
      {
          jatek.PlayerMovement(MozgasIrany.Up,Field);
  
      }
      else if (e.Key == Key.Down)
      {
          jatek.PlayerMovement(MozgasIrany.Down,Field);
      }
      else if (e.Key == Key.Left)
      {
          jatek.PlayerMovement(MozgasIrany.Left,Field);
      }
      else if (e.Key == Key.Right)
      {
          jatek.PlayerMovement(MozgasIrany.Right,Field);
      }
  }
  </code></pre>
  
  <p>This is how I move the characters:</p>
  
  <pre><code>public void PlayerMovement(MozgasIrany irany, Canvas Aktual)
  {
      switch (irany)
      {
          case MozgasIrany.Up:
              player.Move(0, -10, MozgasIrany.Up);
              break;
          case MozgasIrany.Down:
              player.Move(0, 10, MozgasIrany.Down);
              break;
          case MozgasIrany.Left:
              player.Move(-10, 0, MozgasIrany.Left);
              break;
          case MozgasIrany.Right:
              player.Move(10, 0, MozgasIrany.Right);
              break;
          default:
              break;
      }
  }
  
  public void Move(int x, int y, MozgasIrany irany)
  {
      switch (irany)
      {
          case MozgasIrany.Up:
              if (alakzatTerulet.Y &gt; 0)
              {
  
                  alakzatTerulet.Y += y;
              }
              else
              {
                  alakzatTerulet.Y = 0;
              }
              break;
          case MozgasIrany.Down:
              if (alakzatTerulet.Y &lt; 420)
              {
  
                  alakzatTerulet.Y += y;
              }
              else
              {
                  alakzatTerulet.Y = 420;
              }
              break;
          case MozgasIrany.Left:
              if (alakzatTerulet.X &gt; 0)
              {
                  alakzatTerulet.X += x;
              }
              else
              {
                  alakzatTerulet.X = 0;
              }
              break;
          case MozgasIrany.Right:
              if (alakzatTerulet.X &lt; 610)
              {
                  alakzatTerulet.X += x;
              }
              else
              {
                  alakzatTerulet.X  = 610;
              }
              break;
  
      }
  }
  </code></pre>