feat(actors): listen to animationEnded callback from sprite clones

Fixes #38
This commit is contained in:
Kazhnuz 2019-09-07 20:53:22 +02:00
parent 76fb15f862
commit e6f0315a8c

View file

@ -378,6 +378,7 @@ end
function BaseActor:cloneSprite() function BaseActor:cloneSprite()
if self.sprite.name ~= nil then if self.sprite.name ~= nil then
self.sprite.clone = self.assets.sprites[self.sprite.name]:clone() self.sprite.clone = self.assets.sprites[self.sprite.name]:clone()
self.sprite.clone:setCallbackTarget(self)
end end
end end
@ -389,6 +390,10 @@ function BaseActor:changeAnimation(animation, restart)
end end
end end
function BaseActor:animationEnded(animation)
-- Empty placeholder function
end
function BaseActor:setCustomSpeed(customSpeed) function BaseActor:setCustomSpeed(customSpeed)
if (self.sprite.clone == nil) then if (self.sprite.clone == nil) then
self.assets.sprites[self.sprite.name]:setCustomSpeed(customSpeed) self.assets.sprites[self.sprite.name]:setCustomSpeed(customSpeed)