Quote:
Originally Posted by LedZepp
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.
|
THANKS!
Works great.
Update: This will be used to make the music run smoother as well. So just hang on while I fix this.
Okay, so now, the timer doesn't lag for 100ms every time you adjust the music or volume. And now, because the play button now does play AND pause with no annoying mistakes, the center button is essentially useless. So i'm thinking about putting a menu in when you press it (mainly so I can extend my C# experience and learn something) But i'll try to add something like changing the background or something awesome like that. =D
I'll re-upload the new version: v0.25