From 187f0286df706536574221b74c8340752b3776c1 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 5 May 2019 21:04:00 +0200 Subject: [PATCH] modules/world: put the update functions in the baseactor --- gamecore/modules/world/actors/actor2D.lua | 9 --------- gamecore/modules/world/actors/baseactor.lua | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gamecore/modules/world/actors/actor2D.lua b/gamecore/modules/world/actors/actor2D.lua index 508d88c..af1ec70 100644 --- a/gamecore/modules/world/actors/actor2D.lua +++ b/gamecore/modules/world/actors/actor2D.lua @@ -59,15 +59,6 @@ function Actor2D:setBounceFactor(newBounceFactor) self.bounceFactor = newBounceFactor or 0 end --- UPDATE FUNCTIONS --- Theses functions are activated every steps - -function Actor2D:update(dt) - self:updateTimers(dt) - self:autoMove(dt) - self:updateSprite(dt) -end - -- MOVEMENT FUNCTIONS -- Basic functions from the movement. diff --git a/gamecore/modules/world/actors/baseactor.lua b/gamecore/modules/world/actors/baseactor.lua index 6cbef3b..7f91ac9 100644 --- a/gamecore/modules/world/actors/baseactor.lua +++ b/gamecore/modules/world/actors/baseactor.lua @@ -64,6 +64,21 @@ function BaseActor:destroy() self.isDestroyed = true end +-- UPDATE FUNCTIONS +-- Theses functions are activated every steps + +function BaseActor:update(dt) + self:updateTimers(dt) + self:autoMove(dt) + self:updateSprite(dt) +end + +function BaseActor:autoMove(dt) + -- The base actor don't have coordinate + -- so the autoMove is only usefull to its + -- 2D and 3D childrens +end + -- INPUT FUNCTIONS -- get input from the world object