Пример #1
0
 private void HandleKeyDown(object sender, KeyEventArgs e)
 {
     //If the key was W, then it calls the handleMoveUp method in the controller
     if (e.KeyCode == Keys.W)
     {
         controller.HandleMoveUp();
     }
     //If the key was A, then it calls the handleMoveLeft method in the controller
     if (e.KeyCode == Keys.A)
     {
         controller.HandleMoveLeft();
     }
     //If the key was S, then it calls the handleMoveDown method in the controller
     if (e.KeyCode == Keys.S)
     {
         controller.HandleMoveDown();
     }
     //If the key was D, then it calls the handleMoveRight method in the controller
     if (e.KeyCode == Keys.D)
     {
         controller.HandleMoveRight();
     }
     e.Handled          = true;
     e.SuppressKeyPress = true;
 }