diff options
| author | cursed22bc <admin@pixeldawn.org> | 2026-03-07 23:43:32 +0200 |
|---|---|---|
| committer | cursed22bc <admin@pixeldawn.org> | 2026-03-07 23:43:32 +0200 |
| commit | aeb596379bbf1bec84efb294ff5bbbee922364ba (patch) | |
| tree | deaf13edba484c5d4013dfd094e515b103e2c9d9 /tilemap.lua | |
| parent | 8514ffe0a1aa2febe989b2ff0b3044150492a1b2 (diff) | |
basic water render and physics
Diffstat (limited to 'tilemap.lua')
| -rw-r--r-- | tilemap.lua | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tilemap.lua b/tilemap.lua index ab2a52c..8ad1c9c 100644 --- a/tilemap.lua +++ b/tilemap.lua @@ -1,4 +1,6 @@ local Entity = require("entity") +local Liquid = require("liquid") +local LiquidSurface = require("liquidSurface") local Tilemap = {} Tilemap.__index = Tilemap @@ -34,8 +36,11 @@ local function objectToEntity(obj) type = obj.type, id = obj.id, rotation = obj.rotation, - visible = obj.visible + visible = obj.visible, + shape = obj.shape }) + entity.polygon = obj.polygon + entity.polyline = obj.polyline return entity end @@ -45,6 +50,8 @@ function Tilemap:new(mapPath, tilesets) self.entitiesTiles = {} self.entitiesSpawns = {} self.entitiesCameraBorders = {} + self.entitiesLiquidPolygons = {} + self.entitiesLiquidSurfaces = {} self.layerBackground = nil self.layerGround = nil self.layerForeground = nil @@ -117,6 +124,10 @@ function Tilemap:new(mapPath, tilesets) table.insert(self.entitiesSpawns, entity) elseif name == "camera_border" then table.insert(self.entitiesCameraBorders, entity) + elseif name == "liquid" then + table.insert(self.entitiesLiquidPolygons, Liquid:new(entity)) + elseif name == "liquid_surface" then + table.insert(self.entitiesLiquidSurfaces, LiquidSurface:new(entity)) end end end @@ -126,6 +137,14 @@ function Tilemap:new(mapPath, tilesets) return self end +function Tilemap:getEntitiesLiquidPolygons() + return self.entitiesLiquidPolygons +end + +function Tilemap:getEntitiesLiquidSurfaces() + return self.entitiesLiquidSurfaces +end + function Tilemap:getEntitiesTiles() return self.entitiesTiles end |
