Skip to content

Commit 95c970e

Browse files
fixed a bug for looping animation in CCAnimationCache
1 parent a9821a7 commit 95c970e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cocos2d/sprite_nodes/CCAnimationCache.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ cc.AnimationCache = cc.Class.extend(/** @lends cc.AnimationCache# */{
181181
for (var key in animations) {
182182
var animationDict = animations[key];
183183

184+
var isLoop = animationDict["loop"];
184185
var loopsTemp = parseInt(animationDict["loops"]);
185-
var loops = (isNaN(loopsTemp)) ? 1 : loopsTemp;
186+
var loops = isLoop ? cc.REPEAT_FOREVER : ((isNaN(loopsTemp)) ? 1 : loopsTemp);
186187
var restoreOriginalFrame = (animationDict["restoreOriginalFrame"] && animationDict["restoreOriginalFrame"] == true) ? true : false;
187188
var frameArray = animationDict["frames"];
188189

0 commit comments

Comments
 (0)