Hey there guys thanks for answering lots of my questions last time. Today I tried adding Line of Sight with Bresenham Line algorithm to my game and it works pretty good.I checked 8 lines from my player with bresenham when they collide then drew that. Now though I want to also add coloring to visited tiles. I think I would add it like this:
Oh yea otherwise did I even apply the principle right? The field of view seems so small shouldnt it be much bigger? How would I make it bigger?
--before this when I once draw a tile with the los stuff it should set
tileTablevisited[columnIndex][rowIndex = true
-- later on
tileTablevisited = {}
for i = 1, 50 do
tileTablevisited[i] = {}
for j = 1, 30 do
tileTablevisited[i][j] = false
end
end
-- so a table for the visited tiles and then draw them only when they are true
for i=1,50,1 do
for j=30,1 do
if tileTablevisited[i][j] == true then
local x,y = (i-1)*12+200, (j-1)*12+0
love.graphics.setColor(95,95,95)
love.graphics.draw(tileset,quads[char],x,y)
end
end
end
It somehow doesn't seem to work... it doesnt draw the visited tiles grayish. I attached my love file. It's in map.lua the function fieldofview().
Thanks for your help