The "problem" seems to be cropping up here:
Code: Select all
function orzia_map:determineTileGraphics(tile_config)
for x = 0, self.size_x - 1 do
for y = 0, self.size_y - 1 do
if self.tiles[x][y]:countWalls(self.tiles) == 9 then
self.tiles[x][y].graphic = tile_config["empty"]
else
if self.tiles[x][y].blocked == true then
local adjacentWalls = self.tiles[x][y]:countWallsAdjacent(self.tiles)
if adjacentWalls == 0 then
self.tiles[x][y].graphic = tile_config["map_island"]
elseif adjacentWalls == 1 then
self.tiles[x][y].graphic = tile_config["map_nub"]
elseif adjacentWalls == 2 then
self.tiles[x][y].graphic = tile_config["map_corner"] -- need to detect whether its a corner or a corridor
elseif adjacentWalls == 3 then
self.tiles[x][y].graphic = tile_config["map_wall"]
if math.random(3) == 2 then
self.tiles[x][y].graphic.x = 0
else
self.tiles[x][y].graphic.x = 2
end
end
else
self.tiles[x][y].graphic = tile_config["map_floor"]
end
end
end
end
end
Code: Select all
if math.random(3) == 2 then
self.tiles[x][y].graphic.x = 0
else
self.tiles[x][y].graphic.x = 2
end
For a simple illustration, run the program a few times and you'll see the walls will either ALL display or NONE of them will display. Completely randomly (like the function is set up to do - just it should be doing it tile by tile)
I've attached the LOVE file