modules/world: put solidity initialization into baseactor

This commit is contained in:
Kazhnuz 2019-05-05 21:27:02 +02:00
parent 11fcc4cf99
commit 86b1368a6e
2 changed files with 7 additions and 7 deletions

View file

@ -30,20 +30,18 @@ local Actor2D = BaseActor:extend()
-- Initialise the actor and its base functions
function Actor2D:new(world, type, x, y, w, h, isSolid)
Actor2D.super.new(self, world, type)
self:initPhysics(x, y, w, h, isSolid)
Actor2D.super.new(self, world, type, isSolid)
self:initPhysics(x, y, w, h)
self:register()
end
function Actor2D:initPhysics(x, y, w, h, isSolid)
function Actor2D:initPhysics(x, y, w, h)
self:initHitbox(x, y, w, h)
self:initMovement()
self:setBounceFactor()
self:initGravity()
self.isSolid = isSolid or false
self:setFilter()
end

View file

@ -30,8 +30,10 @@ local Timer = require(cwd .. "utils.timer")
-- INIT FUNCTIONS
-- Initialise the actor and its base functions
function BaseActor:new(world, type)
self.type = type or ""
function BaseActor:new(world, type, isSolid)
self.type = type or ""
self.isSolid = isSolid or false
self:setManagers(world)
self:initKeys()
self:initTimers()