working on color

This commit is contained in:
Jonathan 2024-03-19 12:22:05 -05:00
parent 01a5e768ca
commit dab56a3f8c
2 changed files with 21 additions and 8 deletions

View File

@ -38,7 +38,7 @@ app:match("/map/render", function(self)
self.tiles[h][i] = map:find({x = h, y = i})
-- The map database has floor_stone and wall_floor instead of simple ASCII characters
-- So we run mapFunc:mapDecrypt to convert it back to the desired characters for visual display
self.tiles[h][i].occupied_by_type = mapFunc:mapDecrypt(self.tiles[h][i].occupied_by_type)
self.tiles[h][i].occupied_by_type = mapFunc:mapDecrypt(self.tiles[h][i].occupied_by_type)[1]
end
end
return {render = "map", layout = false}

View File

@ -19,11 +19,26 @@ local map = {
end
end,
mapDecrypt = function(self, tile)
if tile == "floor_stone" then
return "-"
elseif tile == "wall_stone" then
return "w"
end
-- TODO: Rework function so it returns both char and mat type
-- This introduces breaking changes
local tileset = {}
if string.find(tile, "wall") then
tileset[1] = "w"
elseif string.find(tile, "floor") then
tileset[1] = "-"
end
if string.find(tile, "stone") then
tileset[2] = "stone"
elseif string.find(tile, "wood") then
tileset[2] = "wood"
end
return tileset
-- if tile == "floor_stone" then
-- return "-"
-- elseif tile == "wall_stone" then
-- return "w"
-- end
end,
-- Map Populate / check if map exists
populate = function(self, map)
@ -46,8 +61,6 @@ local map = {
return true
end
end,
tileColor = function(self)
end
}
local tiles = {}