love.graphics.translate by whole numbers

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
DekuJuice
Prole
Posts: 14
Joined: Mon Nov 24, 2014 9:31 pm

love.graphics.translate by whole numbers

Post by DekuJuice » Sun Mar 22, 2015 7:45 pm

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?

bobbyjones
Party member
Posts: 728
Joined: Sat Apr 26, 2014 7:46 pm

Re: love.graphics.translate by whole numbers

Post by bobbyjones » Sun Mar 22, 2015 8:03 pm

I believe you can floor the player coords as well.
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

User avatar
DekuJuice
Prole
Posts: 14
Joined: Mon Nov 24, 2014 9:31 pm

Re: love.graphics.translate by whole numbers

Post by DekuJuice » Sun Mar 22, 2015 9:17 pm

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.

User avatar
DaedalusYoung
Party member
Posts: 402
Joined: Sun Jul 14, 2013 8:04 pm

Re: love.graphics.translate by whole numbers

Post by DaedalusYoung » Sun Mar 22, 2015 11:34 pm

Don't change the actual player's coordinates, just round them during draw.

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests