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.
|
-- Draw the actors.
|
||||||
|
|
||||||
function Actor2D:draw()
|
function Actor2D:draw()
|
||||||
|
self:drawStart()
|
||||||
local x, y = math.floor(self.x), math.floor(self.y)
|
local x, y = math.floor(self.x), math.floor(self.y)
|
||||||
self:drawSprite(x, y)
|
self:drawSprite(x, y)
|
||||||
|
self:drawEnd()
|
||||||
end
|
end
|
||||||
|
|
||||||
return Actor2D
|
return Actor2D
|
||||||
|
|
|
@ -106,10 +106,20 @@ end
|
||||||
-- UPDATE FUNCTIONS
|
-- UPDATE FUNCTIONS
|
||||||
-- Theses functions are activated every steps
|
-- Theses functions are activated every steps
|
||||||
|
|
||||||
|
function BaseActor:updateStart(dt)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
function BaseActor:update(dt)
|
function BaseActor:update(dt)
|
||||||
|
self:updateStart(dt)
|
||||||
self:updateTimers(dt)
|
self:updateTimers(dt)
|
||||||
self:autoMove(dt)
|
self:autoMove(dt)
|
||||||
self:updateSprite(dt)
|
self:updateSprite(dt)
|
||||||
|
self:updateEnd(dt)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BaseActor:updateEnd(dt)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BaseActor:autoMove(dt)
|
function BaseActor:autoMove(dt)
|
||||||
|
@ -150,6 +160,22 @@ function BaseActor:timerResponse(name)
|
||||||
-- here come the timer responses
|
-- here come the timer responses
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- DRAW FUNCTIONS
|
||||||
|
-- Draw the actors.
|
||||||
|
|
||||||
|
function BaseActor:drawStart()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function BaseActor:draw()
|
||||||
|
self:drawStart()
|
||||||
|
self:drawEnd()
|
||||||
|
end
|
||||||
|
|
||||||
|
function BaseActor:drawEnd()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- SPRITES FUNCTIONS
|
-- SPRITES FUNCTIONS
|
||||||
-- Handle the sprite of the actor
|
-- Handle the sprite of the actor
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue