/// <summary> /// call up highscore screen /// </summary> private void EndGame() { //the program will close and go back to the main Program Form f = this.FindForm(); f.Controls.Remove(this); EndScreen es = new EndScreen(); f.Controls.Add(es); }
private void MenuScreen_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.N: p1Ready = true; break; case Keys.V: p2Ready = true; break; case Keys.Escape: Application.Exit(); break; case Keys.Space: //option to go to highscores Form f = this.FindForm(); f.Controls.Remove(this); EndScreen es = new EndScreen(); f.Controls.Add(es); break; } //If all player hit key load up GameScreen if (p1Ready) { //TODO make p1Ready Label ready1.Visible = true; } else { ready1.Visible = false; } if (p2Ready) { //TODO make p2Ready label ready2.Visible = true; } else { ready2.Visible = false; } if (p1Ready && p2Ready) { //Start GameScreen Form f = this.FindForm(); f.Controls.Remove(this); GameScreen gs = new GameScreen(); f.Controls.Add(gs); } }