Beispiel #1
0
 private void UpdateScreen(object sender, EventArgs e)
 {
     if (SnakeSettings.GameOver == true)
     {
         if (Button_Detector.ButtonPressed(Keys.Enter))
         {
             StartGame();
         }
     }
     else
     {
         if (Button_Detector.ButtonPressed(Keys.Left) && Attribute.Move != Movement.Right)
         {
             Attribute.Move = Movement.Left;
         }
         else if (Button_Detector.ButtonPressed(Keys.Right) && Attribute.Move != Movement.Left)
         {
             Attribute.Move = Movement.Right;
         }
         else if (Button_Detector.ButtonPressed(Keys.Up) && Attribute.Move != Movement.Bottom)
         {
             Attribute.Move = Movement.Up;
         }
         else if (Button_Detector.ButtonPressed(Keys.Down) && Attribute.Move != Movement.Up)
         {
             Attribute.Move = Movement.Bottom;
         }
         SnakeMoving();
     }
     GameScreen.Invalidate();
 }
Beispiel #2
0
 private void Snake_KeyUp(object sender, KeyEventArgs e)
 {
     Button_Detector.ButtonChanged(e.KeyCode, false);
 }