WIP: new-cbs #117

Closed
kazhnuz wants to merge 23 commits from new-cbs into master
Showing only changes of commit 84e48c0320 - Show all commits

View file

@ -87,9 +87,18 @@ function Animator:changeAnimation(name, restart)
restart = restart or false
end
if (self.sprite.data.animations[name] ~= nil) then
self.currentAnimation = name
else
self.currentAnimation = self.sprite.data.metadata.defaultAnim
end
self.animationData = self.sprite.data.animations[self.currentAnimation]
if (self.animationData == nil) then
error("animation " .. self.currentAnimation .. " not found.")
end
if (restart == true) then
self.frame = self.animationData.startAt
self.frameTimer = 0