Exemple #1
0
        private void finishGan_Click(object sender, EventArgs e)
        {
            mainMenu menu = new mainMenu();

            menu.Visible = true;
            this.Close();
        }
Exemple #2
0
        private void The_Snake_Field_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Up)
            {
                snakeDirection = "Up";
            }
            if (e.KeyCode == Keys.Down)
            {
                snakeDirection = "Down";
            }
            if (e.KeyCode == Keys.Left)
            {
                snakeDirection = "Left";
            }
            if (e.KeyCode == Keys.Right)
            {
                snakeDirection = "Right";
            }
            if (e.KeyCode == Keys.Escape)
            {
                updateField.Stop();
                this.Close();
                mainMenu mainMenu = new mainMenu();
                mainMenu.Visible = true;
            }
            if (e.KeyCode == Keys.Space)
            {
                ++clicksBtn;
                switch (clicksBtn)
                {
                case 1:
                    updateField.Stop();
                    break;

                case 2:
                    updateField.Start();
                    break;
                }
                if (clicksBtn == 2)
                {
                    clicksBtn = 0;
                }
            }
        }