Original Post
Hi,
I did a tutorial on screen management, although for xna 3.0 / 3.1 i got it to work for 4.0. But when i started adding a menu to it i ran into some problems.
At first the start screen loads with 3 options:
Start -> Goes to character creation
Load 0> does nothing yet
Exit -> Exits game
The charcreationscreen has another 3 options
Reroll -> does nothing yet
Accept -> starts game
Back -> back to start screen
Now when i go to the charcreation screen and then hit back i can't go to the character creation screen anymore, the string for it is showing, i can select it but enter does not do anything. The exit option still works though. Do i need to reset the screen component
I did a tutorial on screen management, although for xna 3.0 / 3.1 i got it to work for 4.0. But when i started adding a menu to it i ran into some problems.
At first the start screen loads with 3 options:
Start -> Goes to character creation
Load 0> does nothing yet
Exit -> Exits game
The charcreationscreen has another 3 options
Reroll -> does nothing yet
Accept -> starts game
Back -> back to start screen
Now when i go to the charcreation screen and then hit back i can't go to the character creation screen anymore, the string for it is showing, i can select it but enter does not do anything. The exit option still works though. Do i need to reset the screen component
- or something?
Heres the code in game1 update, dunno if you need more code though...
protected override void Update(GameTime gameTime)
{
keyboardState = Keyboard.GetState();
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
if (activeScreen == startScreen)
{
if (CheckKey(Keys.Enter))
{
if (startScreen.SelectedIndex == 0)
{
activeScreen.Hide();
activeScreen = characterCreationScreen;
activeScreen.Show();
}
if (startScreen.SelectedIndex == 2)
{
this.Exit();
}
}
}
if (activeScreen == characterCreationScreen)
{
if (CheckKey(Keys.Enter))
{
if (characterCreationScreen.SelectedIndex == 0)
{
//reroll character stats
}
if (characterCreationScreen.SelectedIndex == 1)
{
activeScreen.Hide();
activeScreen = actionScreen;
activeScreen.Show();
}
if (characterCreationScreen.SelectedIndex == 2)
{
activeScreen.Hide();
activeScreen = startScreen;
activeScreen.Show();
}
}
}
base.Update(gameTime);
oldKeyboardState = keyboardState;
}