love.keyboard.setKeyRepeat
Enables key repeating and sets the delay and interval.
Contents
Function
Synopsis
love.keyboard.setKeyRepeat( delay, interval )
Arguments
number delay
- The amount of time before repeating the key (in milliseconds). 0 disables key repeat.
number interval
- The amount of time between repeats (in milliseconds)
Returns
Nothing.
Examples
Hold key to continue moving left or right
Please note that a generally better way to move an object would be to put code in love.update() which uses love.keyboard.isDown. This is just an example.
function love.load()
x = 400
love.keyboard.setKeyRepeat(10, 200)
end
function love.keypressed(key)
if key == "left" then x = x - 20
elseif key == "right" then x = x + 20
end
end
function love.draw()
love.graphics.circle("fill", x,300, 30,30)
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