feat(actor): add *Start() and *End() functions
This commit is contained in:
parent
055ae92eb9
commit
58b8c95d62
2 changed files with 28 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue