Keyboard
Posted: Sat May 23, 2020 8:03 pm
Hello, I was wondering what was the command I need to use if I want an action when I press a key on the keyboard but when I release it, the action stops. Anyone know the answer?
Code: Select all
function love.update()
...
if love.keyboard.isDown('a') then -- Let's press 'A' for example
-- Do Action
end
end
Code: Select all
function love.keypressed(key)
if key == 'a' then
-- Do Action
end
end
function love.keyreleased(key)
if key == 'a' then
-- Stop Action
end
end