core/assets: add a function to know if an animation exists

This commit is contained in:
Kazhnuz 2019-03-04 12:37:07 +01:00
parent f9b4adb3b7
commit c738bb9bf9
2 changed files with 8 additions and 0 deletions

View File

@ -69,6 +69,10 @@ function Animator:getFrame()
return self.frame
end
function Animator:animationExist(name)
return (self.sprite.data.animations[self.currentAnimation] ~= nil)
end
function Animator:draw(x, y, r, sx, sy, ox, oy, kx, ky)
self.sprite:drawFrame(self.frame, x, y, r, sx, sy, ox, oy, kx, ky)
end

View File

@ -58,6 +58,10 @@ function Sprite:changeAnimation(name, restart)
self.animator:changeAnimation(name, restart)
end
function Sprite:animationExist(name)
return self.animator:animationExist(name)
end
function Sprite:drawAnimation(x, y, r, sx, sy, ox, oy, kx, ky)
self.animator:draw(x, y, r, sx, sy, ox, oy, kx, ky)
end