Beispiel #1
0
 private void MyForm_KeyDown(object sender, KeyEventArgs e)
 {
     if ((e.KeyCode == Keys.Enter) && !(game.GetGameStatus()))
     {
         label.Dispose();
         panel.Dispose();
         panel = new MyPanel(1);
         this.Controls.Add(panel);
         game.GameStop();
         game = new Game(this);
         game.ChangeGameStatus();
     }
     else if (e.KeyCode == Keys.Up)
     {
         game.UpdateMovement(0);
     }
     else if (e.KeyCode == Keys.Down)
     {
         game.UpdateMovement(1);
     }
     else if (e.KeyCode == Keys.Left)
     {
         game.UpdateMovement(2);
     }
     else if (e.KeyCode == Keys.Right)
     {
         game.UpdateMovement(3);
     }
 }