Quote:
Originally Posted by ShotgunSnipist
That's what I had thought too.
But this game is SO small and loops so fast after it pauses it it goes to the bottom of the program loops back to the top and finds your still holding your finger down and un-pauses it again. It's really quite annoying. So I programmed it this way.
|
Use a boolean.
Declare something like:
bool pressed = false;
Now just modify your DPad.B(Play/Pause) code to look like this:
if (!pressed && GamePad.GetState(PlayerIndex.One).DPad.B == ButtonState.Pressed)
{
your code here
pressed = true;
}
if (pressed && GamePad.GetState(PlayerIndex.One).DPad.B == ButtonState.
Released)
{
pressed = false;
}
What this does is it checks for a boolean to be false when pressing the button, if its false it carries the code under it out and then makes the boolean true therefore not letting it loop again until you release the button and it makes the boolean false again.