I have tried setCenter()
setBounds()
moveTo()
and gfx.setDrawOffset()
but can't get it to start in the correct position. What is the best way to approach this?
For context, I am trying to implement a shootemup style background that scrolls upwards from the bottom.
I think the issue I was having was a weird interaction between drawOffset()
and draw(x,y, sourceRect)
. I recreated a minimal example that works:
function playdate.update()
gfx.clear()
counter += 1
yPos = height - counter
--gfx.setDrawOffset(-24, counter)
floor:draw(0, 0, 0, yPos, 400, 240)
coins:draw(0, 0, 0, yPos, 400, 240)
end
In the process a possible bug was discovered, reported here: Tilemap behaves unexpectedly when drawOffset is set
2 Likes