From 6f160bac033726c9bddecee42f24616ee537c4be Mon Sep 17 00:00:00 2001 From: cursed22bc Date: Mon, 9 Mar 2026 23:48:43 +0200 Subject: hacking layering --- tilemap.lua | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'tilemap.lua') diff --git a/tilemap.lua b/tilemap.lua index 8ad1c9c..09ce8d6 100644 --- a/tilemap.lua +++ b/tilemap.lua @@ -53,10 +53,13 @@ function Tilemap:new(mapPath, tilesets) self.entitiesLiquidPolygons = {} self.entitiesLiquidSurfaces = {} self.layerBackground = nil + self.layerDecorationBackground = nil + self.layerDecorationForeground = nil + self.layerFarground = nil self.layerGround = nil self.layerForeground = nil - self.tileWidth = 8 - self.tileHeight = 8 + self.tileWidth = 16 + self.tileHeight = 16 self.mapWidth = 0 self.mapHeight = 0 self.tileGidInfo = {} @@ -65,8 +68,8 @@ function Tilemap:new(mapPath, tilesets) local mapData = loadMapData(mapPath) self.mapData = mapData - self.tileWidth = mapData and (mapData.tilewidth or 8) or 8 - self.tileHeight = mapData and (mapData.tileheight or 8) or 8 + self.tileWidth = mapData and (mapData.tilewidth or 16) or 16 + self.tileHeight = mapData and (mapData.tileheight or 16) or 16 self.mapWidth = (mapData and mapData.width or 0) * self.tileWidth self.mapHeight = (mapData and mapData.height or 0) * self.tileHeight @@ -98,6 +101,9 @@ function Tilemap:new(mapPath, tilesets) if layer.type == "tilelayer" and layer.name then local n = layer.name:lower() if n == "background" then self.layerBackground = layer + elseif n == "farground" then self.layerFarground = layer + elseif n == "decoration_background" then self.layerDecorationBackground = layer + elseif n == "decoration_foreground" then self.layerDecorationForeground = layer elseif n == "ground" then self.layerGround = layer elseif n == "foreground" then self.layerForeground = layer end @@ -183,6 +189,18 @@ function Tilemap:getBackgroundLayer() return self.layerBackground end +function Tilemap:getFargroundLayer() + return self.layerFarground +end + +function Tilemap:getDecorationBackgroundLayer() + return self.layerDecorationBackground +end + +function Tilemap:getDecorationForegroundLayer() + return self.layerDecorationForeground +end + function Tilemap:getGroundLayer() return self.layerGround end -- cgit v1.2.3