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.
Weird graphics glitch with .5 coordinates and scaling
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Weird graphics glitch with .5 coordinates and scaling
This is just how GPUs draw textures: when texels don't exactly align with pixels, they get interpolated, i.e. smeared.
Re: Weird graphics glitch with .5 coordinates and scaling
Use rounded coordinates, for drawing only (don't modify the original values).
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Who is online
Users browsing this forum: Bing [Bot] and 0 guests