Page 1 of 1
love.graphics.translate by whole numbers
Posted: Sun Mar 22, 2015 7:45 pm
by DekuJuice
I'm having a problem with moving the camera in my game. Every update, I'm setting the camera's position to the player's. However, since the player's position is a decimal number, there's noticeable screen tearing whenever the camera is moved. The problem is that if I use math.floor or math.ceil to round the camera's position, the player itself jitters around whenever the camera moves. How can I make sure the player doesn't jitter without causing screen tearing?
Re: love.graphics.translate by whole numbers
Posted: Sun Mar 22, 2015 8:03 pm
by bobbyjones
I believe you can floor the player coords as well.
Re: love.graphics.translate by whole numbers
Posted: Sun Mar 22, 2015 9:17 pm
by DekuJuice
That works fine for the x axis, but rounding the player's y coordinate, at least to a whole number, is not an option.
Edit: Er, scratch that, turns out I can round the y coordinate if I put in some workarounds, but I'd still prefer if there was a way to do this without changing the player's coordinates.
Re: love.graphics.translate by whole numbers
Posted: Sun Mar 22, 2015 11:34 pm
by DaedalusYoung
Don't change the actual player's coordinates, just round them during draw.