Page 1 of 1

Keyboard "up", "down", "left", "right" keys problem?

Posted: Wed Aug 03, 2011 4:53 am
by philipdnichols
It looks like only 2 of these keys can be detected to be pressed, released or down at a time. Does anyone know if this is a known issue? It looks like any other number of keyboard keys can be held down and handled correctly.

For example, if I have a character moving onscreen with the following code in love.update(timeInSeconds):

Code: Select all

self._velocity.y = 0
if love.keyboard.isDown("up") then
	self._velocity.y = self._velocity.y - 1
end
if love.keyboard.isDown("down") then
	self._velocity.y = self._velocity.y + 1
end
	
self._velocity.x = 0
if love.keyboard.isDown("left") then
	self._velocity.x = self._velocity.x - 1
end
if love.keyboard.isDown("right") then
	self._velocity.x = self._velocity.x + 1
end
If I hold down left and right, my character freezes, as expected. However, if I hold down left, up and the right, I would expect the character to only move up, but the additional press of the right key does not get detected.

Thanks for any help!

Re: Keyboard "up", "down", "left", "right" keys problem?

Posted: Wed Aug 03, 2011 5:39 am
by Taehl
This isn't an issue for me. I suspect that this is something your keyboard does on a hardware or driver level, as different keyboards have different ways and limits of locking multi-key input.

Re: Keyboard "up", "down", "left", "right" keys problem?

Posted: Wed Aug 03, 2011 5:42 am
by XQYZ
Depending on your keyboard it might be a hardware issue since there's a limit to the simultaneous key presses of keys that are wired together on the same lanes.

Re: Keyboard "up", "down", "left", "right" keys problem?

Posted: Wed Aug 03, 2011 6:43 am
by Tesselode
What XQYZ said. It's pretty common.

Re: Keyboard "up", "down", "left", "right" keys problem?

Posted: Wed Aug 03, 2011 9:03 am
by T-Bone
My old PC did this too. Very annoying. Hardware issue, can't really be helped.

Re: Keyboard "up", "down", "left", "right" keys problem?

Posted: Wed Aug 03, 2011 12:54 pm
by philipdnichols
Ahhh I see. This makes sense.

Thanks for the replies guys!