field of view roguelike

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
imgifty
Prole
Posts: 13
Joined: Wed Nov 20, 2013 12:58 pm

field of view roguelike

Post by imgifty »

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?

Image

Code: Select all


--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
Attachments
testgame.love
(168.18 KiB) Downloaded 136 times
Post Reply

Who is online

Users browsing this forum: No registered users and 60 guests