core/assets: force restart of animator when animation name have changed
This commit is contained in:
parent
38b0a732c5
commit
f9b4adb3b7
|
@ -74,6 +74,13 @@ function Animator:draw(x, y, r, sx, sy, ox, oy, kx, ky)
|
|||
end
|
||||
|
||||
function Animator:changeAnimation(name, restart)
|
||||
-- Force restart if animation name is different
|
||||
if (self.currentAnimation ~= name) then
|
||||
restart = true
|
||||
else
|
||||
restart = restart or false
|
||||
end
|
||||
|
||||
self.currentAnimation = name
|
||||
self.animationData = self.sprite.data.animations[self.currentAnimation]
|
||||
|
||||
|
|
Loading…
Reference in New Issue