Weird graphics glitch with .5 coordinates and scaling
Posted: Tue May 16, 2017 9:16 pm
I'm currently working on a tile-based platformer where the levels are made up of a 50x50 grid of blocks the player can jump on. In order to provide the illusion of moving, I subtract the player's coordinates from the coordinates of every tile once each frame. I also scale the display by calling the love.graphics.scale function one time in the love.load function (with a factor of 3). However, I've noticed a weird phenomenon with this configuration - if the player has exactly (or very close to) a coordinate with a decimal of .5 (and thus all of the other tiles also have a .5 coordinate), a weird graphical glitch occurs. Here's an image without the glitch:
Here's an image with the glitch:
It seems like Love can't decide where to place a sprite, and so the pixels are in slightly different places. Does anyone have any idea on how to fix this, except for just not using decimal coordinates? Thank you.
Here's an image with the glitch:
It seems like Love can't decide where to place a sprite, and so the pixels are in slightly different places. Does anyone have any idea on how to fix this, except for just not using decimal coordinates? Thank you.