modules/world: add more wrapper around sprites functions

This commit is contained in:
Kazhnuz 2019-05-05 15:22:54 +02:00
parent 782ff6a329
commit 53df3c125c

View file

@ -99,6 +99,7 @@ end
function Actor2D:update(dt)
self:autoMove(dt)
self:updateSprite(dt)
end
-- MOVEMENT FUNCTIONS
@ -245,6 +246,22 @@ function Actor2D:cloneSprite()
end
end
function Actor2D:changeAnimation(animation, restart)
if (self.sprite.clone == nil) then
self.assets.sprites[self.sprite.name]:changeAnimation(animation, restart)
else
self.sprite.clone:changeAnimation(animation, restart)
end
end
function Actor2D:setCustomSpeed(customSpeed)
if (self.sprite.clone == nil) then
self.assets.sprites[self.sprite.name]:setCustomSpeed(customSpeed)
else
self.sprite.clone:setCustomSpeed(customSpeed)
end
end
function Actor2D:updateSprite(dt)
if (self.sprite.clone ~= nil) then
self.sprite.clone:update(dt)