ch1mera

Members
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

176 Neutral

About ch1mera

  • Rank
    Newbie
  1. Help with menu selection in XNA

      Changed the code to what you suggested with no luck. Now it doesn't highlight anything but the play button which is set to active by default.   //Menu selections private void MainMenuSelection() { KeyboardState currentKeyboardState; currentKeyboardState = Keyboard.GetState(); // If player presses down arrow, select credits if (currentKeyboardState.IsKeyUp(Keys.Down) && previousKeyboardState.IsKeyDown(Keys.Down) && creditsButton.active == true) { playButton.active = false; creditsButton.active = true; } // If player presses down again, highlight exit if (currentKeyboardState.IsKeyUp(Keys.Down) && previousKeyboardState.IsKeyDown(Keys.Down) && exitButton.active == true) { creditsButton.active = false; exitButton.active = true; } previousKeyboardState = currentKeyboardState; Would it be easier for you if I PMed you the entire Game1.cs code?   We can PM if you like.    I think this solution should work, the problem is that its done in the wrong order, if that makes sense. In the first condition you're stating that it will only run if creditsButton.active == true, but the value of creditsButton.active isn't set to true until you're inside the statement. What you want the first condition to have is playButton.active == true instead, as it seems that this value is default set to true just as the play button (as you said) is default set to to active.    and likewise in the second condition, instead of exitButton.active == true, you want creditsButton.active == true. 
  2. Help with menu selection in XNA

    //Menu selections private void MainMenuSelection() { KeyboardState currentKeyboardState; currentKeyboardState = Keyboard.GetState(); // If player presses down arrow, select credits if (currentKeyboardState.IsKeyUp(Keys.Down) && previousKeyboardState.IsKeyDown(Keys.Down)) { playButton.active = false; creditsButton.active = true; } // If player presses down again, highlight exit if (currentKeyboardState.IsKeyUp(Keys.Down) && previousKeyboardState.IsKeyDown(Keys.Down)) { creditsButton.active = false; exitButton.active = true; } previousKeyboardState = currentKeyboardState; I am putting this method at the bottom of Game1 and calling it in the Update() of Game1.   I believe the edit to my previous post should solve the problem.
  3. Help with menu selection in XNA

    Do you mind sharing the updated code? I don't know why this solution wouldn't work off the top of my head.   EDIT:    Actually now that i take a step away from the PC, i realized what the problem is. You're performing both conditions at the same time. So your second condition would be something along these lines:        if (currentKeyboardState.IsKeyUp(Keys.Down) && previousKeyboardState.IsKeyDown(Keys.Down) && creditsButton.active = true)       since you don't want the exit button to be the "next in line" to be highlighted until the button above that is already selected.    Hope that works!
  4. Help with menu selection in XNA

    So whats going on here is you're saying if the current keyboard down key is pressed and the previous keyboard down key is not pressed. Well at the moment, your second statement will always return true until the key is initially pressed, I believe that what you want to do is use the "IsKeyUp" method on the currentKeyboardState.    Like So:        if (currentKeyboardState.IsKeyUp(Keys.Down) && previousKeyboardState.IsKeyDown(Keys.Down))  { //... }  
  5. Trouble with importing my own modules

    As ultramailman mentioned, you initialized "WHITE" but never used it anywhere. The value is correct for a true white color, it just comes down to setting the color of the screen.        screen.fill(WHITE);        and after that you are going to want to make sure that you use pygame's flip method to properly display the screen.        pygame.display.flip();    
  6. GamePad input not working

    Thanks for the reply. I am using Monogame. Also, using exit(); with keyboard input works just fine.    Even when running the template, which includes the block of code you mentioned, keyboard works fine but the controller does not.
  7. GamePad input not working

    Hi, long time lurker, first time poster. I have a bit of experience with Python and C#, however I'm new to the xna framework. I have a wired xbox 360 controller connected, drivers are up to date. The controller works just fine in other applications, however I can't get the input to work, at all in the programs i write.    Keyboard input works just fine, it's just the gamepad that is giving me problems.       In case anyone is curious: GamePadState gamePad1 = GamePad.GetState(PlayerIndex.One); if (gamePad1.Buttons.B == ButtonState.Pressed) exit();     I'm sure the solution will turn out to be an obvious one...    Thanks,