How to prevent Flappy Bird Clone from starting up automatically??

Hi all.

So, I followed this tutorial online [https://www.youtube.com/watch?v=zrfPk7qRmVs] on how to make a Flappy Bird Clone using XNA. All works incredibly well, however there is one problem.

The game starts to play as soon as I click Run. Is there any way to stop this? I’ve added a menu, but the game continues to play on top of the menu as soon as I run it. I’d really like to load the menu first, then let the game begin to play.

Any help would be much appreciated.

I do something like

bool running = false;

public void Update(GameTime gameTime)
{
         if(running)
         {
             ...update game
         }
         else
         {
             ...update menu,
         }
}

public void Draw(SpriteBatch spriteBatch)
{
         if(running)
         {
              ...Draw game
         }
         else
         {
              ...Draw menu
         }
}

In the menu update if the Run button clicked then running = true;

1 Like

Hi,

Thanks for the reply. So do you write this in the main Game1.cs file?

Yes, where you call the Update & Draw methods for the game and menu.

Great. Do you mind helping me with what to change exactly? I’ve already written code, but don’t really want to create any errors when editing it right now.