private void Select2(object sender, EventArgs e) { //creates a new level 2 form when you select level 2 then closes the level select form Level2 Level_2 = new Level2(); Level_2.Show(); Level_2.Location = this.Location; Level_2.TopMost = true; this.Close(); }
//the following stops the playes movement if the key is no longer being pressed private void KeyIsUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Left) { goLeft = false; } if (e.KeyCode == Keys.Right) { goRight = false; } if (jumping == true) { jumping = false; } //allows the level to be restarted if the player dies if (e.KeyCode == Keys.Enter && isGameOver == true) { RestartGame(); } // Go to level 2 When you win if (e.KeyCode == Keys.Enter && Win == true) { Level2 Level_2 = new Level2(); Level_2.Show(); Level_2.Location = this.Location; Level_2.TopMost = true; this.Close(); } //press esc to get back to main menu if (e.KeyCode == Keys.Escape && Win == false) { MainMenu main = new MainMenu(); main.Show(); main.Location = this.Location; main.TopMost = true; this.Close(); } }