I’m having issues with a flickering effect during camera easing in my pixel art game. Originally my easing included floats but when I zoomed in i noticed that the pixels in my sprites were occasionally moving at different rates creating an odd effect to the eye.
Since then I restricted camera movement to ints and that has solved most of the problem. But on some textures where there are single pixel borders I still get an odd flickering effect especially on the y axis. I notice it’s resolved when I zoom my game in ~15-20% but I was trying to avoid that if possible because it kinda messes with the mechanics of the game.
Heres a video example. any advice would help.
camera code:
local function moveCamera(self, player) local x, y = player.x, player.y local finalX, finalY if player.dead then finalX, finalY = x,y else if not self.camY then self.camY = y else local diff = (y-self.camY) \* 0.03 self.camY = math.round(self.camY + diff) end finalX, finalY = x, self.camY end finalX = h.clamp(finalX, display.contentWidth/2, self.data.width - display.contentWidth/2) finalY = h.clamp(finalY, display.contentHeight/2, self.data.height - display.contentHeight/2-16) self.positionCamera(math.round(finalX), math.round(finalY))