Smooth line
Posted: Thu Dec 31, 2015 4:11 pm
Good evening,
I want to draw a line, following my player, but the line looks jagged (not related to missing AA) if the player is doing a sideway movement. See attached screenshot for the situation.
What I'm doing (just the line related stuff):
Any ideas?
And while I have this thread, any ideas how to make the line a little wider each few ticks, equally smooth, though.
I want to draw a line, following my player, but the line looks jagged (not related to missing AA) if the player is doing a sideway movement. See attached screenshot for the situation.
What I'm doing (just the line related stuff):
Code: Select all
local lines = {}
function love.update()
-- Move Lines
for i = 1, #lines, 1 do
if i % 2 == 0 then
lines[i] = lines[i] - 10 -- this will move the y-coord of the line 10 up, to simulate movement.
end
end
-- Create new line
table.insert(lines, objects.player.body:getX())
table.insert(lines, objects.player.body:getY())
table.insert(lines, objects.player.body:getX())
table.insert(lines, objects.player.body:getY() - 10)
end
function love.draw(dt)
love.graphics.setColor(0, 0, 0)
love.graphics.setLineWidth(4*win_scale)
love.graphics.setLineStyle("smooth")
love.graphics.setLineJoin("none")
if #lines > 2 then
love.graphics.line(lines)
end
end
And while I have this thread, any ideas how to make the line a little wider each few ticks, equally smooth, though.