private void hideButton_Click(object sender, EventArgs e) { InGame = true; for (int i = 10; i != 0; i--) { roomDescription.Text = "Counting down from " + i; opponent.Move(); Application.DoEvents(); Thread.Sleep(350); } MoveToLocation(LivingRoom); RedrawForm(); hideButton.Visible = false; }
private void hideButton_Click(object sender, EventArgs e) { hideButton.Visible = false; for (int i = 1; i <= 10; i++) { opponent.Move(); descriptionBox.Text = i + "... "; Application.DoEvents(); System.Threading.Thread.Sleep(500); } descriptionBox.Text = "Ready or not, here I come!"; Application.DoEvents(); System.Threading.Thread.Sleep(500); goButton.Visible = true; locationSelectionBox.Visible = true; moveToNewLocation(livingRoom); }
private void hideButton_Click(object sender, EventArgs e) { for (int i = 1; i < 11; i++) { description.Text = i.ToString() + "……"; System.Threading.Thread.Sleep(200); opponent.Move(); Application.DoEvents(); } description.Text = "Ready or not,here I come!"; Application.DoEvents(); System.Threading.Thread.Sleep(500); goHereButton.Visible = true; exits.Visible = true; hideButton.Visible = false; MoveToANewLocation(livingRoom); }
private void hide_Click(object sender, EventArgs e) { hide.Visible = false; for (int i = 0; i < 10; i++) { opponent.Move(); description.Text = $"{i}..."; //Without Application.DoEvents, the text box doesn't refresh and //the program looks frozen. Application.DoEvents(); System.Threading.Thread.Sleep(200); } description.Text = "Ready or not, here I come!"; Application.DoEvents(); System.Threading.Thread.Sleep(500); goHere.Visible = true; exits.Visible = true; MoveToANewLocation(livingRoom); }
private void hide_Click(object sender, EventArgs e) { hide.Visible = false; for (int i = 1; i <= 10; i++) { description.Text = i + "... "; opponent.Move(); Application.DoEvents(); System.Threading.Thread.Sleep(200); } description.Text = "Ready or not, here I come!"; Application.DoEvents(); System.Threading.Thread.Sleep(500); goHere.Visible = true; exits.Visible = true; MoveToANewLocation(livingRoom); }