Esempio n. 1
0
 void button1_Click(Object sender, EventArgs e)
 {
     buttonClicked = true;
     button1.Enabled = false;
     button2.Enabled = false;
     button3.Enabled = false;
     button4.Enabled = false;
     Car Player1 = new Car(1, 0);
     playerList.Add(Player1);
     button1.Visible = false;
     button2.Visible = false;
     button3.Visible = false;
     button4.Visible = false;
 }
Esempio n. 2
0
 void button2_Click(Object sender, EventArgs e)
 {
     buttonClicked = true;
     button1.Enabled = false;
     button2.Enabled = false;
     button3.Enabled = false;
     button4.Enabled = false;
     Car Player1 = new Car(0, 0);
     Car Player2 = new Car(2, 1);
     playerList.Add(Player1);
     playerList.Add(Player2);
     button1.Visible = false;
     button2.Visible = false;
     button3.Visible = false;
     button4.Visible = false;
     this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown1);
 }
Esempio n. 3
0
        void button5_Click(Object sender, EventArgs e)
        {
            Invalidate();
            winnerLabel.Visible = false;
            buttonClicked = true;
            textBox1.Visible = false;
            button5.Visible = false;
            button6.Visible = false;
            if (playerList.Count == 1)
            {
                playerList.Clear();
                buttonClicked = true;
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = false;
                button4.Enabled = false;
                Car Player1 = new Car(1, 0);
                playerList.Add(Player1);
                button1.Visible = false;
                button2.Visible = false;
                button3.Visible = false;
                button4.Visible = false;
                /*
                playerList[0].reset();
                 * */

            }
            else if (playerList.Count == 2)
            {
                playerList.Clear();
                buttonClicked = true;
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = false;
                button4.Enabled = false;
                Car Player1 = new Car(0, 0);
                Car Player2 = new Car(2, 1);
                playerList.Add(Player1);
                playerList.Add(Player2);
                button1.Visible = false;
                button2.Visible = false;
                button3.Visible = false;
                button4.Visible = false;
                /*
                playerList[0].reset();
                playerList[1].reset();
                 * */
            }
            else if (playerList.Count == 3)
            {
                playerList.Clear();
                buttonClicked = true;
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = false;
                button4.Enabled = false;
                Car Player1 = new Car(0, 0);
                Car Player2 = new Car(1, 1);
                Car Player3 = new Car(2, 2);
                playerList.Add(Player1);
                playerList.Add(Player2);
                playerList.Add(Player3);
                button1.Visible = false;
                button2.Visible = false;
                button3.Visible = false;
                button4.Visible = false;
                /*
                playerList[0].reset();
                playerList[1].reset();
                playerList[2].reset();
                 * */

            }
            else
            {
                playerList.Clear();
                buttonClicked = true;
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = false;
                button4.Enabled = false;
                Car Player1 = new Car(0, 0);
                Car Player2 = new Car(1, 1);
                Car Player3 = new Car(2, 2);
                Car Player4 = new Car(3, 3);
                playerList.Add(Player1);
                playerList.Add(Player2);
                playerList.Add(Player3);
                playerList.Add(Player4);
                button1.Visible = false;
                button2.Visible = false;
                button3.Visible = false;
                button4.Visible = false;
                /*
                playerList[0].reset();
                playerList[1].reset();
                playerList[2].reset();
                playerList[3].reset();
                 * */
            }


        }