Ugly outlines
Posted: Tue Jul 29, 2014 6:04 pm
I have a problem, where my character animated with AnAL has strange and ugly outlines. What is causing them and how can i get rid of them?
Code: Select all
function player.draw()
if love.keyboard.isDown('left') == false and love.keyboard.isDown('right') == false
and player.y == 528 and player.facingR then
player.idleRAnim:draw(math.floor(player.x), player.y)
elseif love.keyboard.isDown('left') == false and love.keyboard.isDown('right') == false
and player.y == 528 and player.facingR == false then
player.idleLAnim:draw(math.floor(player.x), player.y)
end
if love.keyboard.isDown('right') then
player.walkingRAnim:draw(math.floor(player.x), player.y)
elseif love.keyboard.isDown('left') and love.keyboard.isDown('right') == false then
player.walkingLAnim:draw(math.floor(player.x), player.y)
end
end
Cucurbitacée wrote:Hi,
This happened to me before, that's because you are drawing at x coordinate that is not an integer. Here is what I did to fix it:Not sure if it's the right way to do it, though.Code: Select all
function player.draw() if love.keyboard.isDown('left') == false and love.keyboard.isDown('right') == false and player.y == 528 and player.facingR then player.idleRAnim:draw(math.floor(player.x), player.y) elseif love.keyboard.isDown('left') == false and love.keyboard.isDown('right') == false and player.y == 528 and player.facingR == false then player.idleLAnim:draw(math.floor(player.x), player.y) end if love.keyboard.isDown('right') then player.walkingRAnim:draw(math.floor(player.x), player.y) elseif love.keyboard.isDown('left') and love.keyboard.isDown('right') == false then player.walkingLAnim:draw(math.floor(player.x), player.y) end end
Thanks guys. Seem that this solves the problem!Ranguna259 wrote:Yeah that can fix it too, just use math.floor() or math.ceil() on the coordinates.