Im having a problem in my code when 3 keys are pressed at the same time.
When I press
- Up + Right + Space: moves and the object fires
- Up + left + Space: moves but doesn’t fire
- Down +Right + Space: moves but doesn’t fire
- Down + Left + Space: moves but doesn’t fire
- All other 2 key combinations are fine.
here is my code:
if (newkbState.IsKeyDown(Keys.Up))
player.MoveFwd();
else if (newkbState.IsKeyDown(Keys.Down))
player.MoveBkwd();
else
player.StopMoving();
if (newkbState.IsKeyDown(Keys.Left))
player.TurnLeft();
else if (newkbState.IsKeyDown(Keys.Right))
player.TurnRight();
else
player.StopTurning();
if (newkbState.IsKeyDown(Keys.Space))
player.Fire();
Rather basic problem – but does the keyboard support having more than 3 keys at the same time? “Ghosting” as its called is not unheard of in older keyboards:
https://www.microsoft.com/appliedsciences/antighostingexplained.mspx
Are you 100% sure its your code?