public void resetTask(String Car) { selectPlayer sp = new selectPlayer(); if (playerDetails.Text.Equals("Rocky")) { Rocky = sp.betAmount(carDetails.Text, Car, BetAmount, Rocky); rocky_has.Text = "Rocky has " + Rocky; } if (playerDetails.Text.Equals("Gamby")) { Gamby = sp.betAmount(carDetails.Text, Car, BetAmount, Gamby); gamby_has.Text = "Gamby has " + Gamby; } if (playerDetails.Text.Equals("Pargeet")) { Pargeet = sp.betAmount(carDetails.Text, Car, BetAmount, Pargeet); pargeet_has.Text = "Pargeet has " + Pargeet; } if (playerDetails.Text.Equals("Simon")) { Simon = sp.betAmount(carDetails.Text, Car, BetAmount, Simon); simon_has.Text = "Simon has " + Simon; } super1.Left = 0; super2.Left = 0; super3.Left = 0; super4.Left = 0; carDetails.Text = ""; playerDetails.Text = ""; selected_amount.Text = ""; lblRecord.Text = ""; BetAmount = 0; btn_Race.Visible = false; }
private void timer1_Tick(object sender, EventArgs e) { selectPlayer SP = new selectPlayer(); if (super1.Left <= 750) { SP.getNumber(); super1.Left += SP.Num; } else { timer1.Stop(); resetTask("1"); MessageBox.Show("Car 1 won the Race "); } if (super2.Left <= 750) { SP.getNumber(); super2.Left += SP.Num; } else { timer1.Stop(); resetTask("2"); MessageBox.Show("Car 2 won the Race "); } if (super3.Left <= 750) { SP.getNumber(); super3.Left += SP.Num; } else { timer1.Stop(); resetTask("3"); MessageBox.Show("Car 3 won the Race "); } if (super4.Left <= 750) { SP.getNumber(); super4.Left += SP.Num; } else { timer1.Stop(); resetTask("4"); MessageBox.Show("Car 4 won the Race "); } }