Code: Select all
if love.keyboard.isDown("up") then
love.graphics.translate(0,0.2)
end
Code: Select all
if love.keyboard.isDown("up") then
love.graphics.translate(0,0.2)
end
Code: Select all
function love.draw()
local x = 10
local y = 10
love.graphics.point(x, y) -- This point is drawn at 10, 10
love.graphics.translate(20, 20)
love.graphics.point(x, y) -- This point is drawn at 30, 30 thanks to translation. We didn't change the x, y variables.
end
Code: Select all
local ty = 0
function love.draw()
love.graphics.translate(0,ty)
... other draw stuff ...
end
function love.update(dt)
if love.keyboard.isDown('up') then
ty = ty + 0.2 -- this is framerate dependent! use ty = ty + 10 * dt to make it move 10 pixels per second
end
... other update stuff ...
end
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests