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!