Exemple #1
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Up)
            {
                game.ChangeDirecton(Direction.up);
            }
            else if (e.KeyCode == Keys.Down)
            {
                game.ChangeDirecton(Direction.down);
            }

            else if (e.KeyCode == Keys.Right)
            {
                game.ChangeDirecton(Direction.right);
            }
            else if (e.KeyCode == Keys.Left)
            {
                game.ChangeDirecton(Direction.left);
            }
        }