modules/world: add more wrapper around sprites functions
This commit is contained in:
parent
782ff6a329
commit
53df3c125c
1 changed files with 17 additions and 0 deletions
|
@ -99,6 +99,7 @@ end
|
||||||
function Actor2D:update(dt)
|
function Actor2D:update(dt)
|
||||||
|
|
||||||
self:autoMove(dt)
|
self:autoMove(dt)
|
||||||
|
self:updateSprite(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- MOVEMENT FUNCTIONS
|
-- MOVEMENT FUNCTIONS
|
||||||
|
@ -245,6 +246,22 @@ function Actor2D:cloneSprite()
|
||||||
end
|
end
|
||||||
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)
|
function Actor2D:updateSprite(dt)
|
||||||
if (self.sprite.clone ~= nil) then
|
if (self.sprite.clone ~= nil) then
|
||||||
self.sprite.clone:update(dt)
|
self.sprite.clone:update(dt)
|
||||||
|
|
Loading…
Reference in a new issue