I'm asking this to make something move in LOVE2D when a key is pressed.
I've already tried
repeat
imgx = imgx + 1
timer.after(0, function() end)
until not love.keyboard.isDown('left')
But it did not work. Please help me!
Entire code:
function love.load()
timer = require 'hump.timer'
face = love.graphics.newImage("face.png")
imgx = 0
imgy = 0
end
function love.keypressed(key)
if key == 'left' then
repeat
imgx = imgx + 1
timer.after(0, function() end)
until not love.keyboard.isDown('left')
end
end
function love.update(dt)
timer.update(dt)
end
function love.draw()
love.graphics.draw(face, imgx, imgy)
end