Search code examples
c#xna2d-games

Restart game XNA


How can I make a game to restart when I lose? My game is structured in 3 parts: mainMenu,Game and the end (when you lose). So I divided the Update and draw method in 3 parts. Now I need the option to restart the game if I lose.

bool lost=false; //when it is "true" I lost
if(lost==true)
{
    if(Keyboard.GetState().IsKeyDown(Keys.Enter))
    {
    // Restart game
    }
}

Solution

  • you need to make sure you set lost = false when you restart