Ejemplo n.º 1
0
        private void FormSnake_KeyDown(object sender, KeyEventArgs e)
        {
            Movement movement;

            switch (e.KeyCode)
            {
            case Keys.Left:
                movement = Movement.Left;
                break;

            case Keys.Right:
                movement = Movement.Right;
                break;

            case Keys.Up:
                movement = Movement.Up;
                break;

            case Keys.Down:
                movement = Movement.Down;
                break;

            default:
                movement = _game.Snake.PreviousMovement;
                break;
            }

            if (_game.CheckChanceMove(movement))
            {
                _game.Snake.NextMovement = movement;
            }
        }