Keyboard "up", "down", "left", "right" keys problem?
Posted: Wed Aug 03, 2011 4:53 am
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):
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!
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
Thanks for any help!