Ejemplo n.º 1
0
 private void Window_KeyPressed(object sender, SFML.Window.KeyEventArgs e)
 {
     if (e.Code.Equals(Keyboard.Key.A) && direction != 1)
     {
         direction = 0;
         snake.HeadLeft();
     }
     else
     if (e.Code.Equals(Keyboard.Key.D) && direction != 0)
     {
         direction = 1;
         snake.HeadRight();
     }
     else
     if (e.Code.Equals(Keyboard.Key.W) && direction != 3)
     {
         direction = 2;
         snake.HeadUp();
     }
     else
     if (e.Code.Equals(Keyboard.Key.S) && direction != 2)
     {
         direction = 3;
         snake.HeadDown();
     }
 }