diff --git a/gamecore/modules/world/actors/actor2D.lua b/gamecore/modules/world/actors/actor2D.lua index a7501aa..473389d 100644 --- a/gamecore/modules/world/actors/actor2D.lua +++ b/gamecore/modules/world/actors/actor2D.lua @@ -36,7 +36,6 @@ function Actor2D:new(world, type, x, y, w, h, isSolid) self:initPhysics(x, y, w, h, isSolid) self:register() - self:initKeys() self:initTimers() end @@ -65,17 +64,6 @@ function Actor2D:setBounceFactor(newBounceFactor) self.bounceFactor = newBounceFactor or 0 end --- INPUT FUNCTIONS --- get input from the world object - -function Actor2D:initKeys() - self.keys = core.input.fakekeys -end - -function Actor2D:getInput(keys) - self.keys = keys or core.input.fakekeys -end - -- TIMER FUNCTIONS -- Control the integrated timers of the actor diff --git a/gamecore/modules/world/actors/baseactor.lua b/gamecore/modules/world/actors/baseactor.lua index 57dcade..8258654 100644 --- a/gamecore/modules/world/actors/baseactor.lua +++ b/gamecore/modules/world/actors/baseactor.lua @@ -30,6 +30,7 @@ local BaseActor = Object:extend() function BaseActor:new(world, type) self.type = type or "" self:setManagers(world) + self:initKeys() self:setDebugColor(1, 1, 1) end @@ -58,4 +59,15 @@ function BaseActor:destroy() self.isDestroyed = true end +-- INPUT FUNCTIONS +-- get input from the world object + +function BaseActor:initKeys() + self.keys = core.input.fakekeys +end + +function BaseActor:getInput(keys) + self.keys = keys or core.input.fakekeys +end + return BaseActor