chore: prepare for division in mixins

This commit is contained in:
Kazhnuz Klappsthul 2020-11-25 13:30:10 +01:00
parent 730d89a76c
commit b97d320dc7
4 changed files with 13 additions and 13 deletions

View File

@ -22,17 +22,17 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local cwd = (...):gsub('%.actor2D$', '') .. "."
local BaseActor = require(cwd .. "baseactor")
local Actor2D = BaseActor:extend()
local BaseActor = require("birb.modules.world.actors.mixins.base")
local Actor2D = Object:extend()
Actor2D:implement(BaseActor)
local Hitbox = require(cwd .. "utils.hitbox2D")
local Hitbox = require("birb.modules.world.actors.utils.hitbox2D")
-- INIT FUNCTIONS
-- Initialise the actor and its base functions
function Actor2D:new(world, type, x, y, w, h, isSolid)
Actor2D.super.new(self, world, type, x, y, 0, w, h, 0, isSolid)
self:init(world, type, x, y, 0, w, h, 0, isSolid)
self:initHitboxes()
end

View File

@ -23,8 +23,9 @@
]]
local cwd = (...):gsub('%.actor3D$', '') .. "."
local BaseActor = require(cwd .. "baseactor")
local Actor3D = BaseActor:extend()
local BaseActor = require("birb.modules.world.actors.mixins.base")
local Actor3D = Object:extend()
Actor3D:implement(BaseActor)
local Hitbox = require(cwd .. "utils.hitbox3D")
local Boxes = require(cwd .. "utils.boxes")
@ -33,7 +34,7 @@ local Boxes = require(cwd .. "utils.boxes")
-- Initialise the actor and its base functions
function Actor3D:new(world, type, x, y, z, w, h, d, isSolid)
Actor3D.super.new(self, world, type, x, y, z, w, h, d, isSolid)
self:init(world, type, x, y, z, w, h, d, isSolid)
self:initHitboxes()
self.world:registerShape(self)
self.boxes = Boxes

View File

@ -22,16 +22,13 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
local cwd = (...):gsub('%.baseactor$', '') .. "."
local BaseActor = Object:extend()
local Timer = require(cwd .. "utils.timer")
local Sprite = require(cwd .. "utils.sprites")
local Sprite = require("birb.modules.world.actors.utils.sprites")
-- INIT FUNCTIONS
-- Initialise the actor and its base functions
function BaseActor:new(world, type, x, y, z, w, h, d, isSolid)
function BaseActor:init(world, type, x, y, z, w, h, d, isSolid)
self.type = type or ""
self.isSolid = isSolid or false
self.depth = 0

View File

@ -117,6 +117,8 @@ function Hitbox2D:draw()
local x, y = self:getPosition()
love.graphics.setColor(self.debug.r, self.debug.g, self.debug.b, 1)
utils.graphics.box(x, y, self.w, self.h)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.points(x, y)
utils.graphics.resetColor()
end