I would seriously appreciate that, I donβt know if it helps or not but I can send all the scripts I mentioned at the top.
Dungeon
:
local generationFolder = script.Parent.Parent:WaitForChild("Generation")
local Level = require(generationFolder:WaitForChild("Level"))
---------------------------------------------------------------------------
-- - - - - - - - - - - - - - - Dungeon object - - - - - - - - - - - - - - -
---------------------------------------------------------------------------
-- Dungeon objects have several levels (consisting of Level objects) which
-- together represent a whole dungeon.
Dungeon = {
["nrOfLevels"] = 0,
["height"] = 0,
["width"] = 0,
["levels"] = {}
}
Dungeon.__index = Dungeon
function Dungeon.new(nrOfLevels, height, width)
Dungeon.nrOfLevels = nrOfLevels
Dungeon.height = height
Dungeon.width = width
Dungeon.levels = {}
return Dungeon
end
function Dungeon:generateDungeon(advanced, maxRooms, maxRoomSize, scatteringFactor)
for i = 1, self.nrOfLevels do
local newLevel = Level.new(self.height, self.width)
if advanced then
newLevel:setMaxRooms(maxRooms)
newLevel:setMaxRoomSize(maxRoomSize)
newLevel:setScatteringFactor(scatteringFactor)
end
newLevel:generateLevel("gift")
self.levels[i] = newLevel
end
end
function Dungeon:printDungeon()
for i = 1, #Dungeon.levels do
local s = "LEVEL "..i
local space= ""
for i = 1, math.floor((self.width+2)/2-(string.len(s))/4) do
space = space.." "
end
print(space..s..space)
Dungeon.levels[i]:printLevel()
print()
end
end
return Dungeon
HelpFunctions
:
local generationFolder = script.Parent.Parent:WaitForChild("Generation")
local Tile = require(generationFolder:WaitForChild("Tile"))
local random = math.random
local insert = table.insert
local remove = table.remove
-----------------------------------------------------------------------------------
-- - - - - - - - - - - - - - - Global Help Functions - - - - - - - - - - - - - - --
-----------------------------------------------------------------------------------
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
local HelpFunctions = {}
function HelpFunctions:findNext(goal)
-- self = start
-- Finds next step from start position to goal position in a matrix
if self == goal then return goal end
local ow, col = self[1], self[2]
local adj = HelpFunctions.getAdjacentPos(self[1], self[2])
local dist = HelpFunctions.getDist(self, goal)
local nextPos
for i=1,#adj do
local adjT = adj[i]
if (HelpFunctions.getDist(adjT, goal) < dist) and
i%2==0 -- not picking diagonals (would cause too narrow corridors)
then
nextPos = adjT
dist = HelpFunctions.getDist(nextPos, goal)
--break -- uncomment for more rectangular paths!
end
end
return nextPos
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function HelpFunctions:getRandNeighbour(col, notDiag)
if notDiag then
local f = {-1, 1}
local d = f[random(1,2)]
if random()>0.5 then
return self+d, col
else
return self, col+d
end
else
local dir={ random(-1,1), random(-1,1) }
return self+dir[1], col+dir[2]
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function HelpFunctions:withinBounds(c, height, width)
return (self<height and self>0 and c<width and c>0)
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function HelpFunctions:prims()
local len = #self
local root = remove(self, 1)
if #self==0 then return root, root end
local visited={}
insert(visited, root)
local v0
local endIndex
repeat
local dist = 1e309 -- ~inf
for i = 1, #visited do
for j = 1, #self do
if (self[j]:distanceTo(visited[i]) < dist) then
dist = self[j]:distanceTo(visited[i])
v0 = visited[i]
endIndex = j
end
end
end
local v1 = remove(self, endIndex)
v0:addNeighbour(v1)
insert(visited, v1)
until #visited == len
return visited[1], visited[#visited]
end
function HelpFunctions:getAdjacentPos(col)
-- returns table containing all adjacent positions [1]:row [2]:col to given position
-- INCLUDING SELF. to change this:
-- add if (not (dx == 0 and dy == 0)) then ... end
local result = {}
for dx =-1,1 do
for dy=-1,1 do
result[#result+1] = {self+dy, col+dx}
end
end
for i=1,#result do
end
return result
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
-- source: https://stackoverflow.com/questions/2705793/how-to-get-number-of-entries-in-a-lua-table
function HelpFunctions:tablelength()
local count = 0
for _ in pairs(self) do count = count + 1 end
return count
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function HelpFunctions:cloneTable()
local newTable = {}
for k,v in pairs(self) do
newTable[k] = v
end
return newTable
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function HelpFunctions:getDist(goal)
return math.sqrt(math.pow(math.abs(goal[1]-self[1]),2)+math.pow(math.abs(goal[2]-self[2]),2))
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
-----------------------------------------------------------------------------------
-- - - - - - - - - - - Help functions for main examples - - - - - - - - - - - - - -
-----------------------------------------------------------------------------------
function HelpFunctions:initPlayer(level)
local c = level:getRoot().center
local adj = HelpFunctions.getAdjacentPos(c[1], c[2])
local i = 1
repeat
endr, endc = adj[i][1], adj[i][2]
i = i + 1
until level:getTile(endr,endc).class == Tile.FLOOR
level:getTile(endr,endc).class = Tile.PLAYER
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function HelpFunctions:initBoss(level)
local c = level:getRoot().center
local adj = HelpFunctions.getAdjacentPos(c[1], c[2])
local i = 1
repeat
endr, endc = adj[i][1], adj[i][2]
i = i + 1
until level:getTile(endr,endc).class == Tile.FLOOR
level:getTile(endr,endc).class = Tile.BOSS
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
return HelpFunctions
Level
:
local generationFolder = script.Parent.Parent:WaitForChild("Generation")
local generationFolder = script.Parent.Parent:WaitForChild("Generation")
local Func = require(generationFolder:WaitForChild("HelpFunctions"))
local Tile = require(generationFolder:WaitForChild("Tile"))
local Room = require(generationFolder:WaitForChild("Room"))
local random = math.random
local floor = math.floor
local ceil = math.ceil
local min = math.min
local max = math.max
local insert = table.insert
local prims = Func.prims
local findNext = Func.findNext
local getAdjacentPos = Func.getAdjacentPos
local getRandNeighbour = Func.getRandNeighbour
local withinBounds = Func.withinBounds
seed = os.time()
math.randomseed(seed)
-- print("seed: "..seed) -- for debugging
---------------------------------------------------------------------------------------
-- - - - - - - - - - - - - - - - - - - Level object - - - - - - - - - - - - - - -- - --
---------------------------------------------------------------------------------------
-- A Level object consist of several Tile objects which together make up
-- one dungeon level.
Level = {
["height"] = 0,
["width"] = 0,
["matrix"] = {},
["rooms"] = {},
["entrances"] = {},
["staircases"] = {},
["specials"] = {}
}
Level.__index = Level
Level.MIN_ROOM_SIZE = 3
Level.veinSpawnRate = 0.02
Level.soilSpawnRate = 0.05
function Level.new(height, width)
if height < 10 or width < 10 then error("Level must have height>=10, width>=10") end
local level = {
height=height,
width=width,
matrix = {},
rooms = {},
entrances = {},
staircases = {},
specials = {},
rootRoom=nil,
endRoom=nil
}
level.maxRoomSize = ceil(min(height, width)/10)+5
level.maxRooms = ceil(max(height, width)/Level.MIN_ROOM_SIZE)
-- Determines amount of random tiles built when generating corridors:
level.scatteringFactor = ceil(max(height,width)/level.maxRoomSize)
setmetatable(level, Level)
return level
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:generateLevel(special)
-- A default generation of a level including rooms, corridors to each room forming
-- an MSF, staircases and doors. addCycles can be uncommented to dig more corridors.
self:initMap()
self:generateRooms()
local root = self:getRoomTree()
self:buildCorridors(root)
-- self:addCycles(5)
self:addStaircases()
-- self:addDoors()
if special then
self:addSpecial(special, 1)
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:initMap()
-- Create void
for i=-1,self.height+1 do
self.matrix[i] = {}
for j=0,self.width+1 do
self.matrix[i][j] = Tile:new(Tile.EMPTY)
end
end
self:addWalls(0, 0, self.height+1, self.width+1)
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:printLevel()
for i = 0, self.height + 1 do
local row = " "
for j = 0, self.width+1 do
row = row..self.matrix[i][j].class..Tile.EMPTY
--row=row..self.matrix[i][j].roomId..Tile.EMPTY -- for exposing room-ids
end
print(row)
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:buildLevel()
for i = 0, self.height + 1 do
local row = " "
for j = 0, self.width + 1 do
row = row..self.matrix[i][j].class..Tile.EMPTY
--row=row..self.matrix[i][j].roomId..Tile.EMPTY -- for exposing room-ids
end
print(row)
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:getRandRoom()
-- return: Random room in level
local i = random(1,#self.rooms)
return self.rooms[i]
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:getRoot()
-- return: Room that is root of room tree if such has been generated.
return self.rootRoom
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:getEnd()
-- return: Leaf room added last to tree if such has been generated.
return self.endRoom
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:getStaircases()
-- Index [1] for row, [2] for col on individual entry for individual staircase.
return self.staircases
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:getTile(r, c)
return self.matrix[r][c]
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:isRoom(row,col)
return (self:getTile(row,col).roomId ~= 0)
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:setMaxRooms(m)
self.maxRooms=m
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:setScatteringFactor(f)
self.scatteringFactor = f
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:setMaxRoomSize(m)
if m > min(self.height, self.width) or m < 3 then
error("MaxRoomSize can't be bigger than height-3/width-3 or smaller than 3")
end
self.maxRoomSize=m
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:generateRooms()
for i = 1,self.maxRooms do
self:generateRoom()
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:generateRoom()
-- Will randomly place rooms across tiles (no overlapping).
local startRow = random(1, self.height-self.maxRoomSize)
local startCol = random(1, self.width-self.maxRoomSize)
local height = random(Level.MIN_ROOM_SIZE, self.maxRoomSize)
local width = random(Level.MIN_ROOM_SIZE, self.maxRoomSize)
for i=startRow-1, startRow+height+1 do
for j=startCol-1, startCol+width+1 do
if (self:isRoom(i,j)) then
return -- Room is overlapping other room->room is discarded
end
end
end
self:buildRoom(startRow, startCol, startRow+height, startCol+width)
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:getRoomTree()
if #self.rooms < 1 then error("Can't generate room tree, no rooms exists") end
local root, lastLeaf = prims(table.clone(self.rooms))
self.rootRoom = root
self.endRoom = lastLeaf
return root
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:buildRoom(startR, startC, endR, endC)
-- init room object and paint room onto tiles.
local id = #self.rooms+1
local room = Room:new(id)
local r,c =endR-floor((endR-startR)/2), endC-floor((endC-startC)/2)
room:setCenter(r,c)
insert(self.rooms, room)
for i=startR, endR do
for j=startC, endC do
local tile = self:getTile(i,j)
tile.roomId, tile.class = id, Tile.FLOOR
end
end
self:addWalls(startR-1, startC-1, endR+1, endC+1)
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:buildCorridors(root)
-- Recursive DFS function for building corridors to every neighbour of a room (root)
for i = 1, #root.neighbours do
local neigh = root.neighbours[i]
self:buildCorridor(root, neigh)
self:buildCorridors(neigh)
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:buildCorridor(from, to)
-- Parameters from and to are both Room-objects.
local start, goal = from.center, to.center
local nextTile = findNext(start, goal)
local row, col
repeat
row, col = nextTile[1], nextTile[2]
self:buildTile(row, col)
if random() < self.scatteringFactor*0.02 then
self:buildRandomTiles(row,col) -- Makes the corridors a little more interesting
end
nextTile = findNext(nextTile, goal)
until (self:getTile(nextTile[1], nextTile[2]).roomId == to.id)
insert(self.entrances, {row, col})
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:buildTile(r, c)
-- Builds floor tile surrounded by walls.
-- Only floor and empty tiles around floor tiles turns to walls.
local adj = getAdjacentPos(r,c)
self:getTile(r, c).class = Tile.FLOOR
for i=1,#adj do
r, c = adj[i][1], adj[i][2]
if not (self:getTile(r,c).class == Tile.FLOOR) then
self:placeWall(r,c)
end
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
--Functions like these are not used in Pokemon: Mystery Dungeon
--[[function Level:addDoors(maxDoors)
-- Adds open or closed door randomly to entrance tiles.
if #self.entrances == 0 or #self.rooms < 2 then return end
if not maxDoors then maxDoors = #self.entrances end
for i=1,maxDoors do
local e = self.entrances[i]
if self:isValidEntrance(e[1], e[2]) then
local tile = self:getTile(e[1], e[2])
if random() > 0.5 then
tile.class = Tile.C_DOOR
else
tile.class = Tile.O_DOOR
end
end
end
end]]
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:addStaircases(maxStaircases)
-- Adds both descending and ascending staircases to random rooms.
-- Number of staircases depend on number of rooms.
if (not maxStaircases) or (maxStaircases > #self.rooms) then
maxStaircases = ceil(#self.rooms-(#self.rooms/2))+1
end
local staircases = random(2,maxStaircases)
repeat
local room = self:getRandRoom()
if not room.hasStaircase or #self.rooms == 1 then
self:placeStaircase(room, staircases)
staircases = staircases-1
end
until staircases==0
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:addSpecial(special, maxTiles)
print(maxTiles)
-- Adds one special item to the current level
-- Special items such as lost gifts, gummi's, etc.
if (not maxTiles) or (maxTiles > #self.rooms) then
maxTiles = ceil(#self.rooms-(#self.rooms/2))+1
end
print(maxTiles)
local specials = random(1, maxTiles)
repeat
local room = self:getRandRoom()
if not room.hasSpecial or #self.rooms == 1 then
local steps = random(0, floor(self.maxRoomSize/2))
local nrow, ncol = room.center[1], room.center[2]
local row, col
repeat
row, col = nrow, ncol
repeat
nrow, ncol = getRandNeighbour(row, col)
until self:getTile(nrow, ncol).class == Tile.FLOOR
steps = steps - 1
until (self:getTile(nrow, ncol).roomId ~= room.id or steps <= 0)
if special == "gift" then
self:getTile(row, col).class = Tile.SPECIAL_GIFT
elseif special == "gummi" then
self:getTile(row, col).class = Tile.SPECIAL_GUMMI
end
room.hasSpecial = true
insert(self.specials, {row, col})
specials = specials-1
end
until specials == 0
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:addWalls(startR, startC, endR, endC)
-- Places walls on circumference of given rectangle.
-- Upper and lower sides
for j=startC,endC do
self:placeWall(startR, j)
self:placeWall(endR, j)
end
-- Left and right sides
for i=startR,endR do
self:placeWall(i, startC)
self:placeWall(i, endC)
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:placeWall(r, c)
-- Places wall at given coordinate. Could either place
-- regular wall, soil or mineral vein
local tile = self:getTile(r, c)
if random() <= Level.veinSpawnRate then
tile.class = Tile.VEIN
elseif random() <= Level.soilSpawnRate then
tile.class = Tile.SOIL
Level.soilSpawnRate = 0.6 -- for clustering
else
tile.class = Tile.WALL
Level.soilSpawnRate = 0.05
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:placeStaircase(room, staircases)
-- Places staircase in given room.
-- Position is random number of steps away from center.
local steps = random(0, floor(self.maxRoomSize/2))
local nrow, ncol = room.center[1], room.center[2]
local row, col
repeat
row, col = nrow, ncol
repeat
nrow, ncol = getRandNeighbour(row, col)
until self:getTile(nrow, ncol).class == Tile.FLOOR
steps = steps - 1
until (self:getTile(nrow, ncol).roomId ~= room.id or steps <= 0)
if staircases%2 == 0 then
self:getTile(row, col).class = Tile.D_STAIRCASE
else
self:getTile(row, col).class = Tile.A_STAIRCASE
end
room.hasStaircase = true
insert(self.staircases, {row, col})
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:isValidEntrance(row, col)
-- Tile is a valid entrance position if there is a wall above and below it or
-- to the left and to the right of it.
return ((self:getTile(row+1,col):isWall() and self:getTile(row-1,col):isWall()) or (self:getTile(row,col+1):isWall() and self:getTile(row,col-1):isWall()))
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:getAdjacentTiles(row, col)
-- returns table containing all adjacent tiles to given position.
-- Including self!
local result={}
local adj = getAdjacentPos(row,col)
for i = 1, #adj do
local row, col = adj[i][1], adj[i][2]
insert(result, self:getTile(row, col))
end
return result
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:buildRandomTiles(r,c)
-- Creates random floor tiles starting from given tile.
local rand = random(1,self.scatteringFactor)
for i = 1, rand do
local nr,nc = getRandNeighbour(r,c, true)
if (self:getTile(nr,nc).roomId==0 and
withinBounds(nr,nc, self.height, self.width)) then
self:buildTile(nr, nc)
r,c=nr,nc
end
end
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Level:addCycles(maxCycles)
-- Adds corridors between random rooms.
for i = 1, maxCycles do
local from = self:getRandRoom()
local to = self:getRandRoom()
self:buildCorridor(from, to)
end
end
return Level
Room
:
local generationFolder = script.Parent.Parent:WaitForChild("Generation")
local Func = require(generationFolder:WaitForChild("HelpFunctions"))
local pow = math.pow
---------------------------------------------------------------------------
-- - - - - - - - - - - - - - - - Room object - - - - - - - - - - - - - - --
---------------------------------------------------------------------------
-- Room is a Node-like object.
-- * Has unique id
-- * Keeps track of neighbouring rooms by keeping boolean value
-- * at index representing neighbours' id's
Room = {"id", "neighbours", "center", "hasStaircase"}
Room.__index = Room
function Room:new(id)
local room = {
id = id,
neighbours = {},
center = {},
hasStaircase = false
}
setmetatable(room, Room)
return room
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Room:addNeighbour(other)
table.insert(self.neighbours, other)
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Room:hasNeighbours()
return Func.tablelength(self.neighbours)>1
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Room:setCenter(r, c)
self.center = {r, c}
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Room:distanceTo(other)
-- returns distance from self to other room's center.
return math.sqrt(pow(math.abs(self.center[1]-other.center[1]),2)+pow(math.abs(self.center[2]-other.center[2]),2))
end
return Room
And finally, Tile
:
---------------------------------------------------------------------------
-- - - - - - - - - - - - - - - - Tile object - - - - - - - - - - - - - - --
---------------------------------------------------------------------------
-- Tile objects:
-- * Keeps track of room association, if not in room (default): roomId = 0
-- * Has graphic symbol to represent what kind of tile this is in a level
-- * " " for empty
-- * "." for floor
-- * "#" for wall
-- * "<" for ascending staircase
-- * ">" for descending staircase
-- * "%" for soil
-- * "*" for mineral vein
-- * "'" for open door
-- * "+" for closed door
Tile = {
["class"] = "",
["roomId"] = 0
}
Tile.__index = Tile
Tile.EMPTY = " "
Tile.FLOOR = "."
Tile.WALL = "#"
Tile.A_STAIRCASE = "<"
Tile.D_STAIRCASE = ">"
Tile.SOIL = "%"
Tile.VEIN = "*"
--[[Tile.C_DOOR = "+"
Tile.O_DOOR = "'"]]
Tile.SPECIAL_GIFT = "G"
Tile.SPECIAL_GUMMI = "~"
Tile.PLAYER = "@"
Tile.BOSS = "B"
function Tile:new(t)
local tile = {}
tile.class = t
tile.roomId = 0
setmetatable(tile, Tile)
return tile
end
-- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### -- ##### --
function Tile:isWall()
return self.class == Tile.WALL or self.class == Tile.SOIL or self.class == Tile.VEIN
end
return Tile