Sign in to follow this  

How do I stop my game from skipping screens?

This topic is 2055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I used the code from this - [url="http://www.xnadevelopment.com/tutorials/thestateofthings/thestateofthings.shtml"]http://www.xnadevelo...eofthings.shtml[/url] (The second method using enumerations)

I modified it to add a 3rd screen for gameplay and it functioned like the previous screen. The issue is that since the Controller Detect Screen and Title Screen both use the A button to advance. Because of this, it advances through both at the same time, going straight to the gameplay screen. I changed the code (as seen below) so that the Title Screen uses a different button. However, I want to have it so it uses the same button, but not advance at the same time.

Hopefully I explained it correctly.

[CODE] private void UpdateControllerDetectScreen()
{

//Poll all the gamepads (and the keyboard) to check to see

//which controller will be the player one controller

for (int aPlayer = 0; aPlayer < 4; aPlayer++)
{

if (GamePad.GetState((PlayerIndex)aPlayer).Buttons.A == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.A) == true)
{

mPlayerOne = (PlayerIndex)aPlayer;

mCurrentScreen = ScreenState.Title;

return;

}

}

}

private void UpdateTitleScreen()
{

//Move back to the Controller detect screen if the player moves

//back (using B) from the Title screen (this is typical game behavior

//and is used to switch to a new player one controller)

if (GamePad.GetState(mPlayerOne).Buttons.B == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.B) == true)
{

mCurrentScreen = ScreenState.ControllerDetect;

return;

}

if (GamePad.GetState((PlayerIndex)mPlayerOne).Buttons.A == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.C) == true)
{



mCurrentScreen = ScreenState.GamePlay;

return;

}

}

private void UpdateGamePlayScreen()
{

//Move back to the Controller detect screen if the player moves

//back (using B) from the Title screen (this is typical game behavior

//and is used to switch to a new player one controller)

if (GamePad.GetState(mPlayerOne).Buttons.B == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.B) == true)
{

mCurrentScreen = ScreenState.Title;

return;

}





}[/CODE]

Share this post


Link to post
Share on other sites

This topic is 2055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this