private void hide_Click(object sender, EventArgs e) { // Game starts now hide.Visible = false; for (int i = 1; i <= 10; ++i) { // Move opponent 10 times opponent.Move(); // Display counting on text box description.Text = i + "..."; // Sleep for 200ms Application.DoEvents(); System.Threading.Thread.Sleep(200); } // Display that the seeker is ready to search for the opponent description.Text = "Ready or not, here I come!"; // Sleep for 500ms Application.DoEvents(); System.Threading.Thread.Sleep(500); // Make 'Go Here' button and dropdown visible goHere.Visible = true; exits.Visible = true; // Set the seeker to start from living room MoveToANewLocation(livingRoom); }
/// <summary> /// Event handler for the "Hide!" button which causes the opponent /// to hide in a room with a hiding place. Also counts to 10 before /// game begins. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Hide_Click(object sender, EventArgs e) { for (int i = 1; i < 11; i++) { description.Text = i.ToString() + "..."; opponent.Move(); Thread.Sleep(300); Refresh(); } Thread.Sleep(300); RedrawForm(); }
private void hide_Click(object sender, EventArgs e) { hide.Visible = false; for (int i = 1; i <= 10; i++) { opponent.Move(); description.Text = i + "... "; Application.DoEvents(); System.Threading.Thread.Sleep(500); } description.Text = "Ready or not, here I come!"; Application.DoEvents(); System.Threading.Thread.Sleep(2000); goHere.Visible = true; exits.Visible = true; MoveToANewLocation(livingRoom); }
private void hide_Click(object sender, System.EventArgs e) { hide.Enabled = false; for (int i = 1; i < 11; i++) { _opponent.Move(); description.Text = $@"{i}..."; Application.DoEvents(); Thread.Sleep(1000); } description.Text = @"Ready or not here I come!"; Application.DoEvents(); Thread.Sleep(2000); RedrawForm(); }