local sprite
local spriteX = 170
local pixelCanvas
function love.load()
love.window.setMode(640, 400) -- Twice the pixel art canvas size.
love.graphics.setDefaultFilter('nearest', 'nearest')
sprite = love.graphics.newImage('sprite.png')
pixelCanvas = love.graphics.newCanvas(320, 200)
end
function love.update(dt)
spriteX = spriteX + 1.0 * dt
end
function love.keypressed(key)
if key == 'escape' then
love.event.quit()
end
end
function love.draw()
love.graphics.setCanvas(pixelCanvas)
love.graphics.clear()
love.graphics.draw(sprite, 320 - 64 - 2, 2)
love.graphics.translate(0.2, -14.333)
love.graphics.rotate(0.1)
love.graphics.draw(sprite, spriteX, 2)
love.graphics.origin()
love.graphics.setCanvas()
love.graphics.print('Press Esc to quit.', 10, 10)
love.graphics.draw(pixelCanvas, 0, 0, 0, 2.0, 2.0)
end
@gcmartijn I never used quads before. Maybe I should look in to them. At the moment for animation I simply store all images of all frames in a list and then to play animation I simply iterate through the list every frame as I draw the object. Not sure if it's a good way to do it, but works for the most part.
@RNavega Thanks a lot for the examples. I think it is certainly my hardware because I can see jittering in both examples you shared if I move slowly. But I have noticed if I rotate the object even just as small as 1 degree as you did in your example, the jitter is much more tolerable.
The parallax example is awesome and there is no jitter as I move the mouse around but if I slow things down then I can see a bit of jittering but it is not too bad compared to what I had. Considering it is pixel art I think it is perfectly fine.