I'm working on a little game right now, but ran into something strange. First, I read my states into variables, like so:
GamePadState gs1 = GamePad.GetState(PlayerIndex.One);
KeyboardState ks = Keyboard.GetState();
Then I keep everything into booleans:
bool leftkey = ks.IsKeyDown(Keys.Left);
bool rightkey = ks.IsKeyDown(Keys.Right);
bool p1_leftpad = gs1.IsButtonDown(Buttons.DPadLeft);
bool p1_rightpad = gs1.IsButtonDown(Buttons.DPadRight);
However, when I call it on Update, the behaviour differs between keyboard and gamepad.
I'm doing it like this:
//slide to the left
if (leftkey || p1_leftpad)
if (myCharacter.Sprite.CurrentAnimation != "moveLeft" && !upkey && !downkey && !p1_uppad && !p1_downpad)
myCharacter.Sprite.CurrentAnimation = "moveLeft";
Back when I was just using the keyboard, everything was working just fine, but now that I'm using the gamepad too, the animation keeps looping forever once I start playing it. I'm using everything pretty much the same as with the keyboard. What am I missing? Do I really have to use that whole "last state" thing with the gamepad?
Edit: I've also tried using just the gamepad, but the results are the same.