Multiple Key Presses in XNA?

Posted by Bryan Harrington on Game Development See other posts from Game Development or by Bryan Harrington
Published on 2010-12-24T21:20:10Z Indexed on 2010/12/28 1:02 UTC
Read the original article Hit count: 437

Filed under:
|
|
|
|

I'm actually trying to do something fairly simple.

I cannot get multiple key presses to work in XNA. I've tried the following pieces of code.

else if (keyboardState.IsKeyDown(Keys.Down) && (keyboardState.IsKeyDown(Keys.Left)))
{
      //Move Character South-West
}

and I tried.

else if (keyboardState.IsKeyDown(Keys.Down))
            {
                if (keyboardState.IsKeyDown(Keys.Left))
                {
                      //Move Character South-West
                }
            }

Neither worked for me. Single presses work just fine. Any thoughts?

© Game Development or respective owner

Related posts about XNA

Related posts about events