3
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 didn’t 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
It didn’t work... I tried to use
love.graphics.print(imgx,400,300)
,but the value was 0 and did not change– arthurgps2
@arthurgps2 Hm, I’ll have to learn LOVE2D then
– Klaider