feat:add depth based on y position

This commit is contained in:
Kazhnuz 2021-03-20 16:35:38 +01:00
parent e22a293f03
commit 3ede8e6654

View file

@ -8,6 +8,12 @@ function Parent:new(world, type, x, y, w, h, isSolid)
self.charset = self.world.scene.charsetManager self.charset = self.world.scene.charsetManager
end end
function Parent:update(dt)
self.depth = -self.y
Parent.super.update(self, dt)
self.depth = -self.y
end
function Parent:draw() function Parent:draw()
love.graphics.rectangle("fill", math.floor(self.x), math.floor(self.y), self.w, self.h) love.graphics.rectangle("fill", math.floor(self.x), math.floor(self.y), self.w, self.h)
end end