Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Posts
    18

    Spacebar bug in XNA?

    I'm following along with the C# and XNA 101 VTMs, currently on Volume 2 building the Precision game. I'm using XNA 4.0 and am having no difficulty following the lessons that were done using XNA 2.0.

    I do not have an Xbox 360 controller for the PC, so I substituted GamepadState code with my own KeyboardState code to use the keyboard as the input device. The arrow keys move the nanite probe in the corresponding directions, and I set the Spacebar (Keys.Space) for putting it into fast speed mode.

    The thing is, this works for every combination of key presses except the up+left+spacebar key combination (moving diagonally towards the upper left fast, while pressing the spacebar). If I'm already moving diagonally to the upper left, pressing the spacebar does not change the speed. If I press the spacebar first, and then try to move the sprite with the arrow keys, it doesn't move.

    I've tried setting other keys as the toggle for fast, and I don't have the problem. Only with the spacebar. So I think it's unlikely to be a coding issue, otherwise I would post the code.

    Is there something about spacebar functionality in XNA 4.0 that I'm not aware of, or does my system just have a really weird random bug? I haven't noticed spacebar problems in any other application.

  2. #2
    Join Date
    Oct 2010
    Posts
    15
    MIght be a keyboard HW-restriction:

    not all keyboards can handle an arbitrary number of keys pressed, sometimes certain combinations exclude themselves.

    I am not 100%ly sure.. I think 2 keys should always work, 3 might cause problems depending on keyboard.

    More here:
    http://www.tomshardware.co.uk/forum/...yboard-problem

    It's a limitation of the keyboard. Not the interface. All buttons (except qualifiers like CTRL, ALT, SHIFT etc) of the keyboard are arranged in an array and only some simultaneous keypresses can be correctly identified. All keyboards has this problem but they may have it in different ways, since the buttons may be arranged differently in the array.

  3. #3
    Join Date
    Sep 2008
    Location
    Salisbury, UK
    Posts
    2,812
    andi beat me to it! But yeah, that does sound like the answer... I had similar issues with certain combinations of cursor keys, depending on what order my fingers made contact

    I found
    my current avatar on google, so props to THIS GUY who created the original...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •