private void tryButton_Click(object sender, EventArgs e) { gameOver.controls.stop(); //stop music (in case the button is pressed before the game over tune is done playing) Form f = this.FindForm(); f.Controls.Remove(this); Levels.Level_1 l1 = new Levels.Level_1(); f.Controls.Add(l1); l1.Location = new Point((f.Width - l1.Width) / 2, (f.Height - l1.Height) / 2); //center the screen l1.Focus(); }
private void newGameButton_Click(object sender, EventArgs e) { musicTimer.Enabled = false; //stop looping of music menuMusic.controls.stop(); //stop the menu music Form f = this.FindForm(); f.Controls.Remove(this); Levels.Level_1 l1 = new Levels.Level_1(); f.Controls.Add(l1); l1.Location = new Point((f.Width - l1.Width) / 2, (f.Height - l1.Height) / 2); //center the level 1 screen l1.Focus(); }