Skip to main content
gamedev.net
🔒 Locked

GameState Problem

Started by baseball435 Aug 23, 2011 at 3:14 PM 1 replies 900+ views
Original Post
baseball435
baseball435
So I decided to start a new project and the first thing I wanted to do was right up the GameState part for my startMenu and then my GameMenu. So I wrote everything, I have a startMenu background and when I go to run it it loads up the startmenu screen but when I press enter, nothing happens. I tried taking away the 'If' statement (below) and it switched the screens on the startup just fine. Im really getting frustrated because this shold be working but if someone could help me that would be great.

UpdateStartMenu:

private void UpdateStartMenu()
{
KeyboardState ks = new KeyboardState();

if (ks.IsKeyDown(Keys.Enter))
{
mStartMenu = false;
mGame = true;
}
}


The Drawing:

protected override void Draw(GameTime gameTime)
{
spriteBatch.Begin();

// TODO: Add your drawing code here
if (mStartMenu)
{
spriteBatch.Draw(startMenu, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
}
else if(mGame)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
}

spriteBatch.End();

base.Draw(gameTime);
}


I cant figure out why its not working and its really frustrating me because this should be pretty simple. So if you could help me that would be great!
CadetUmfer
CadetUmfer
KeyboardState ks = Keyboard.GetState();
Anthony Umfer
baseball435
baseball435

KeyboardState ks = Keyboard.GetState();


Holy crap I feel retarded. Thanks so much.

~baseball435

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.