Difference between revisions of "love.keyboard.isDown"
m |
|||
Line 3: | Line 3: | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | down = love.keyboard.isDown( key ) | + | down = love.keyboard.isDown( key[, key2, key3, ...] ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
{{param|KeyConstant|key|The key to check.}} | {{param|KeyConstant|key|The key to check.}} | ||
+ | {{New feature|0.7.2| | ||
+ | {{param|KeyConstant|keyN|A key to check}} | ||
+ | }} | ||
=== Returns === | === Returns === | ||
− | {{param|boolean|down|True if the | + | {{param|boolean|down|True if the any supplied key is down, false if not.}} |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Examples == | == Examples == | ||
=== Increase a value while a key is held down === | === Increase a value while a key is held down === |
Revision as of 10:55, 21 October 2012
Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased.
Contents
Function
Synopsis
down = love.keyboard.isDown( key[, key2, key3, ...] )
Arguments
KeyConstant key
- The key to check.
Available since LÖVE 0.7.2
KeyConstant keyN
- A key to check
Returns
boolean down
- True if the any supplied key is down, false if not.
Examples
Increase a value while a key is held down
val = 0 -- establish a variable for later use
function love.update(dt)
if love.keyboard.isDown("up") then
val = val + dt -- we will increase the variable by 1 for every second the key is held down
end
end
See Also
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