105 lines
3.9 KiB
Lua
105 lines
3.9 KiB
Lua
LevelData = {}
|
|
|
|
LevelData.__index = LevelData
|
|
|
|
function LevelData.new()
|
|
local self = {
|
|
{ --floor 1
|
|
walls = {
|
|
{0,0,0,0,0,1,2,2,2,1,0,0,0,0,0},
|
|
{0,0,0,0,0,0,2,0,2,0,0,0,0,0,0},
|
|
{1,1,1,1,1,0,2,0,2,0,1,1,1,1,1},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,2,2,2},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,2,0,0},
|
|
},
|
|
entities = {
|
|
{type = "enemy", x = 1, y = 1, value_str = "1"},
|
|
{type = "enemy", x = 2, y = 1, value_str = "2"},
|
|
{type = "enemy", x = 3, y = 1, value_str = "3"},
|
|
{type = "enemy", x = 4, y = 1, value_str = "4"},
|
|
{type = "enemy", x = 5, y = 1, value_str = "5"},
|
|
{type = "enemy_neg", x = 11, y = 1, value_str = "1"},
|
|
{type = "enemy_neg", x = 12, y = 1, value_str = "2"},
|
|
{type = "enemy_neg", x = 13, y = 1, value_str = "3"},
|
|
{type = "enemy_neg", x = 14, y = 1, value_str = "4"},
|
|
{type = "enemy_neg", x = 15, y = 1, value_str = "5"},
|
|
|
|
{type = "elixir", x = 14, y = 14},
|
|
{type = "elixir", x = 14, y = 15},
|
|
{type = "elixir", x = 15, y = 14},
|
|
{type = "elixir", x = 15, y = 15},
|
|
|
|
{type = "stairs_up", x = 8, y = 2},
|
|
{type = "gate", x = 8, y = 3},
|
|
},
|
|
textboxes = {}
|
|
},
|
|
{ --floor 2
|
|
walls = {
|
|
{0,0,0,0,0,0,2,2,2,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,2,0,2,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,2,0,2,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
|
{2,2,2,0,0,0,0,0,0,0,0,0,2,2,2},
|
|
{2,1,2,0,0,0,0,0,0,0,0,0,2,1,2},
|
|
{2,2,2,0,0,0,0,0,0,0,0,0,2,2,2},
|
|
},
|
|
entities = {
|
|
{type = "vorpal", x = 4, y = 8},
|
|
{type = "pickaxe", x = 12, y = 8},
|
|
|
|
{type = "stairs_down", x = 8, y = 2},
|
|
},
|
|
textboxes = {}
|
|
},
|
|
}
|
|
|
|
--convert value_str into value
|
|
for f=1,#self do
|
|
local entities = self[f].entities
|
|
for e=1,#entities do
|
|
if entities[e].value_str then
|
|
arr = {}
|
|
num = 0
|
|
for i=1,#entities[e].value_str do
|
|
arr[i] = entities[e].value_str:sub(i,i)
|
|
end
|
|
for i=1,#arr do
|
|
if arr[i]=="G" then
|
|
num = num * 1000 * 1000 * 1000
|
|
elseif arr[i]=="M" then
|
|
num = num * 1000 * 1000
|
|
elseif arr[i]=="k" then
|
|
num = num * 1000
|
|
else
|
|
num = num*10+arr[i]
|
|
end
|
|
end
|
|
-- print("converted value_str "..entities[e].value_str.." into value "..num)
|
|
entities[e].value = num
|
|
end
|
|
end
|
|
end
|
|
setmetatable(self, LevelData)
|
|
return self
|
|
end
|
|
|
|
return LevelData |