local BaseMap = require "core.modules.world.maps.parent" local BattleMap = BaseMap:extend() function BattleMap:new(world, maptype, mapname) BattleMap.super.new(self, world) self:setPadding(0, 96, 0, 0) self.directory = game.utils.getMapDirectory(maptype, mapname) self.mappath = game.utils.getMapPath(maptype, mapname) self.background = love.graphics.newImage(self.directory .. "background.png") self.data = require(self.mappath) self.assets = world.scene.assets end function BattleMap:loadCollisions() local w, h = self:getDimensions() self.world:newCollision("floor", 0, 0, -16, w, h, 16) for i, block in ipairs(self.data.blocks) do self:addBlock(block[1], block[2], block[3], block[4], block[5], block[6]) end end function BattleMap:addBlock(x, y, w, h, top, bottom) if (self.assets.images[top] == nil) then self.assets:addImage(top, self.directory .. top .. ".png") end if (self.assets.images[bottom] == nil) then self.assets:addImage(bottom, self.directory .. bottom .. ".png") end self.world.obj.collisions["textured"](self.world, x*2, y, 0, w*2, h, 48, top, bottom) end function BattleMap:getDimensions() local w, h = self.background:getDimensions() return w, (h/2) end function BattleMap:loadPlayers() self.world:addPlayer(16, 16, 0, 1) end function BattleMap:loadActors() -- Empty Placeholder function end function BattleMap:draw() love.graphics.draw(self.background, 0, 0, 0, 1, 0.5) end function BattleMap:drawParallax(x, y, w, h) -- Empty Placeholder function end return BattleMap