Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased.
down = love.keyboard.isDown( key )
KeyConstant key
boolean down
Available since LÖVE 0.7.2
This variant is not supported in earlier versions.
anyDown = love.keyboard.isDown( key, ... )
KeyConstant key
KeyConstant ...
boolean anyDown
local val = 0; function love.update(dt) -- We will increase the variable by 1 for every second the key is held down. if love.keyboard.isDown("up") then val = val + dt print(val) end -- We will decrease the variable by 1/s if any of the wasd keys is pressed. if love.keyboard.isDown('w', 'a', 's', 'd') then val = val - dt print(val) end end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.keyboard.isDown