diff --git a/gamecore/modules/world/actors/actor2D.lua b/gamecore/modules/world/actors/actor2D.lua index fb1d2e7..a6613d2 100644 --- a/gamecore/modules/world/actors/actor2D.lua +++ b/gamecore/modules/world/actors/actor2D.lua @@ -193,8 +193,10 @@ end -- Draw the actors. function Actor2D:draw() + self:drawStart() local x, y = math.floor(self.x), math.floor(self.y) self:drawSprite(x, y) + self:drawEnd() end return Actor2D diff --git a/gamecore/modules/world/actors/baseactor.lua b/gamecore/modules/world/actors/baseactor.lua index 501c91d..ef9a325 100644 --- a/gamecore/modules/world/actors/baseactor.lua +++ b/gamecore/modules/world/actors/baseactor.lua @@ -106,10 +106,20 @@ end -- UPDATE FUNCTIONS -- Theses functions are activated every steps +function BaseActor:updateStart(dt) + +end + function BaseActor:update(dt) + self:updateStart(dt) self:updateTimers(dt) self:autoMove(dt) self:updateSprite(dt) + self:updateEnd(dt) +end + +function BaseActor:updateEnd(dt) + end function BaseActor:autoMove(dt) @@ -150,6 +160,22 @@ function BaseActor:timerResponse(name) -- here come the timer responses end +-- DRAW FUNCTIONS +-- Draw the actors. + +function BaseActor:drawStart() + +end + +function BaseActor:draw() + self:drawStart() + self:drawEnd() +end + +function BaseActor:drawEnd() + +end + -- SPRITES FUNCTIONS -- Handle the sprite of the actor