modules/world: better separation of init functions

This commit is contained in:
Kazhnuz 2019-04-08 19:40:27 +02:00
parent a4aaa28c24
commit f30bbc7509

View file

@ -1,15 +1,26 @@
local Actor2D = Object:extend()
function Actor2D:new(world, type, x, y, w, h)
self.type = type or ""
self:setManagers(world)
self:initPhysics(x, y, w, h)
self:initKeys()
self:register()
end
function Actor2D:setManagers(world)
self.world = world
self.scene = world.scene
self.obj = world.obj
end
function Actor2D:initPhysics(x, y, w, h)
self.x = x or 0
self.y = y or 0
self.w = w or 0
self.h = h or 0
self.type = type or ""
self:initKeys()
self:register()
end
function Actor2D:initKeys()