Page 1 of 1

Ugly outlines

Posted: Tue Jul 29, 2014 6:04 pm
by akopyl
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?

Re: Ugly outlines

Posted: Tue Jul 29, 2014 7:13 pm
by Ranguna259
I once fixed something like this by messing around with [wiki]love.graphics.setDefaultFilter[/wiki], my problem was fixed by setting it to "nearest" but this doesn't seam to do it for you.
Try coding your own animation lib, I now that I had a problem with AnAL before and I ended up coding my own animations.

Re: Ugly outlines

Posted: Tue Jul 29, 2014 7:27 pm
by Cucurbitacée
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:

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
Not sure if it's the right way to do it, though.

Re: Ugly outlines

Posted: Tue Jul 29, 2014 11:10 pm
by Ranguna259
Yeah that can fix it too, just use math.floor() or math.ceil() on the coordinates.

Re: Ugly outlines

Posted: Wed Jul 30, 2014 5:26 am
by akopyl
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:

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
Not sure if it's the right way to do it, though.
Ranguna259 wrote:Yeah that can fix it too, just use math.floor() or math.ceil() on the coordinates.
Thanks guys. Seem that this solves the problem!