private void timer4_Tick(object sender, EventArgs e) { if (seconds3 > dice_value) { ; //pause to wait for shuffle dice to end. } else if (seconds3 > 0) { if (p2 == 10 || p2 == 20 || p2 == 30 || p2 == 40 || p2 == 50 || p2 == 60 || p2 == 70 || p2 == 80 || p2 == 90) { p2++; x2 = start_x; y2 -= 64; } else { x2 += 80; p2++; } pb_player2.Location = new Point(x2, y2); } else { timer4.Stop(); snakes_ladders(ref x2, ref y2, ref p2, pb_player2); if (Program.cnt_players == 2) { bt_roll.BackColor = Color.Red; bt_roll.Text = Program.user1 + " ROLL!"; } bt_roll.Visible = true; } if (p2 == 100) { p2 = 100; x2 = 742; y2 = 16; pb_player2.Location = new Point(x2, y2); timer4.Stop(); if (Program.cnt_players == 2) { Program.Update_Win_SAl(Program.user2); Program.Update_Lose(Program.user1); Winner NewWinner = new Winner(Program.user2, return_end, this, return_back); NewWinner.ShowDialog(); } else { if (Program.TypeUser) { Program.Update_Lose(Program.user1); } Winner NewWinner = new Winner("Computer", return_end, this, return_back); NewWinner.ShowDialog(); } } seconds3--; labels(); }
private void timer3_Tick(object sender, EventArgs e) //timer for the moves of player1. { if (seconds3 > dice_value) { ; //pause to wait for shuffle dice to end. } else if (seconds3 > 0) { if (p1 == 10 || p1 == 20 || p1 == 30 || p1 == 40 || p1 == 50 || p1 == 60 || p1 == 70 || p1 == 80 || p1 == 90) { p1++; x1 = start_x; y1 -= 64; } else { x1 += 80; p1++; } pb_player1.Location = new Point(x1, y1); } else { timer3.Stop(); snakes_ladders(ref x1, ref y1, ref p1, pb_player1); if (Program.cnt_players == 1) { flag = 3; } if (Program.cnt_players == 2) { bt_roll.BackColor = Color.Yellow; bt_roll.Text = Program.user2 + " ROLL!"; bt_roll.Visible = true; } } if (p1 == 100) { p1 = 100; x1 = 742; y1 = 16; pb_player1.Location = new Point(x1, y1); if (Program.TypeUser == true) { Program.Update_Win_SAl(Program.user1); if (Program.cnt_players == 2) { Program.Update_Lose(Program.user2); } Winner NewWinner = new Winner(Program.user1, return_end, this, return_back); NewWinner.ShowDialog(); } else { Winner NewWinner = new Winner(Program.guest, return_end, this, return_back); NewWinner.ShowDialog(); } } seconds3--; labels(); }