Difference between revisions of "love.keyboard.isScancodeDown"
(→Returns) |
m (Fixed heading.) |
||
Line 15: | Line 15: | ||
{{param|boolean|down|True if any supplied Scancode is down, false if not.}} | {{param|boolean|down|True if any supplied Scancode is down, false if not.}} | ||
− | === | + | == Examples == |
− | Standard WASD or arrow keys movement | + | |
+ | === Standard WASD or arrow keys for movement === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | function love.update (dt) | + | function love.update(dt) |
− | local up = | + | local up = love.keyboard.isScancodeDown('w', 'up') |
− | local down = | + | local down = love.keyboard.isScancodeDown('s', 'down') |
+ | local left = love.keyboard.isScancodeDown('a', 'left') | ||
local right = love.keyboard.isScancodeDown('d', 'right') | local right = love.keyboard.isScancodeDown('d', 'right') | ||
− | |||
end | end | ||
</source> | </source> |
Revision as of 00:58, 7 February 2022
Available since LÖVE 0.10.0 |
This function is not supported in earlier versions. |
Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased.
Unlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode "w" is used if the key in the same place as the "w" key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are.
Contents
Function
Synopsis
down = love.keyboard.isScancodeDown( scancode, ... )
Arguments
Returns
boolean down
- True if any supplied Scancode is down, false if not.
Examples
Standard WASD or arrow keys for movement
function love.update(dt)
local up = love.keyboard.isScancodeDown('w', 'up')
local down = love.keyboard.isScancodeDown('s', 'down')
local left = love.keyboard.isScancodeDown('a', 'left')
local right = love.keyboard.isScancodeDown('d', 'right')
end
See Also
- love.keyboard
- love.keyboard.isDown
- love.keyboard.getKeyFromScancode
- love.keyboard.getScancodeFromKey
- love.keypressed
- love.keyreleased
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info