2019-12-28 12:15:43 +01:00
|
|
|
local BaseMap = require "core.modules.world.maps.parent"
|
|
|
|
local TestMap = BaseMap:extend()
|
|
|
|
|
|
|
|
function TestMap:new(world)
|
|
|
|
TestMap.super.new(self, world)
|
2020-04-25 12:15:21 +02:00
|
|
|
--self:setPadding(0, 0, 0, 0)
|
2019-12-28 12:15:43 +01:00
|
|
|
|
2020-04-25 12:15:21 +02:00
|
|
|
self.background = love.graphics.newImage("assets/backgrounds/dumbtestmap.png")
|
2019-12-28 12:15:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function TestMap:loadCollisions()
|
2020-04-25 12:15:21 +02:00
|
|
|
local w, h = self:getDimensions()
|
|
|
|
self.world:newCollision("floor", 0, 0, -16, w, h, 16)
|
2019-12-28 12:15:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function TestMap:getDimensions()
|
2020-04-25 12:15:21 +02:00
|
|
|
return self.background:getDimensions()
|
2019-12-28 12:15:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function TestMap:loadPlayers()
|
|
|
|
self.world:addPlayer(16, 16, 0, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
function TestMap:loadActors()
|
|
|
|
-- Empty Placeholder function
|
|
|
|
end
|
|
|
|
|
|
|
|
function TestMap:draw()
|
|
|
|
-- Empty Placeholder function
|
2020-04-25 12:15:21 +02:00
|
|
|
love.graphics.draw(self.background, 0, 0)
|
2019-12-28 12:15:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
function TestMap:drawParallax(x, y, w, h)
|
2020-04-25 12:15:21 +02:00
|
|
|
-- local imax, jmax = (w/32)+1, (h/32)+1
|
|
|
|
-- local x, y = x or 0, y or 0
|
|
|
|
-- local x = math.floor(x/4) % 32
|
|
|
|
-- local y = math.floor((y+96)/6) % 32
|
|
|
|
--
|
|
|
|
-- for i=0, math.ceil(imax) do
|
|
|
|
-- for j=0, math.ceil(jmax) do
|
|
|
|
-- love.graphics.draw(self.background, (i-1)*32-x, (j-1)*32-y)
|
|
|
|
-- end
|
|
|
|
-- end
|
2019-12-28 12:15:43 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return TestMap
|