Re: Going forward and backward with a caracter
Posted: Sat Aug 10, 2013 8:38 pm
Just pass another sprite to drawing function. Duh.
Code: Select all
function love.keypressed(key)
if key == "left" then
love.graphics.scale (-1, 1)
end
end
function love.load()
x = 0
y = 0
bond = love.graphics.newImage("bond.png")
end
function love.update(dt)
if love.keyboard.isDown("right") then
x = x + 2
elseif love.keyboard.isDown("left") then
x = x - 2
end
end
function love.draw()
love.graphics.draw(bond, x, y)
end
Code: Select all
love.graphics.draw ( sprite, x, y, r, xscale, yscale )