modules/world: put solidity initialization into baseactor
This commit is contained in:
parent
11fcc4cf99
commit
86b1368a6e
2 changed files with 7 additions and 7 deletions
|
@ -30,20 +30,18 @@ local Actor2D = BaseActor:extend()
|
||||||
-- Initialise the actor and its base functions
|
-- Initialise the actor and its base functions
|
||||||
|
|
||||||
function Actor2D:new(world, type, x, y, w, h, isSolid)
|
function Actor2D:new(world, type, x, y, w, h, isSolid)
|
||||||
Actor2D.super.new(self, world, type)
|
Actor2D.super.new(self, world, type, isSolid)
|
||||||
self:initPhysics(x, y, w, h, isSolid)
|
self:initPhysics(x, y, w, h)
|
||||||
self:register()
|
self:register()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Actor2D:initPhysics(x, y, w, h, isSolid)
|
function Actor2D:initPhysics(x, y, w, h)
|
||||||
self:initHitbox(x, y, w, h)
|
self:initHitbox(x, y, w, h)
|
||||||
|
|
||||||
self:initMovement()
|
self:initMovement()
|
||||||
self:setBounceFactor()
|
self:setBounceFactor()
|
||||||
self:initGravity()
|
self:initGravity()
|
||||||
|
|
||||||
self.isSolid = isSolid or false
|
|
||||||
|
|
||||||
self:setFilter()
|
self:setFilter()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,10 @@ local Timer = require(cwd .. "utils.timer")
|
||||||
-- INIT FUNCTIONS
|
-- INIT FUNCTIONS
|
||||||
-- Initialise the actor and its base functions
|
-- Initialise the actor and its base functions
|
||||||
|
|
||||||
function BaseActor:new(world, type)
|
function BaseActor:new(world, type, isSolid)
|
||||||
self.type = type or ""
|
self.type = type or ""
|
||||||
|
self.isSolid = isSolid or false
|
||||||
|
|
||||||
self:setManagers(world)
|
self:setManagers(world)
|
||||||
self:initKeys()
|
self:initKeys()
|
||||||
self:initTimers()
|
self:initTimers()
|
||||||
|
|
Loading…
Reference in a new issue