From 266e6e8acc6a842cee03adb99aaa719e1e717b5b Mon Sep 17 00:00:00 2001 From: James Chen Date: Sat, 5 Jan 2013 18:54:08 +0800 Subject: [PATCH] fixed #1641: The coins in Watermelon Me fail to animate in cocos2d-x JS binding. --- cocos2dx/sprite_nodes/CCAnimationCache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2dx/sprite_nodes/CCAnimationCache.cpp b/cocos2dx/sprite_nodes/CCAnimationCache.cpp index e725774ed8..219cc5282e 100644 --- a/cocos2dx/sprite_nodes/CCAnimationCache.cpp +++ b/cocos2dx/sprite_nodes/CCAnimationCache.cpp @@ -153,7 +153,7 @@ void CCAnimationCache::parseVersion2(CCDictionary* animations) const char* name = pElement->getStrKey(); CCDictionary* animationDict = (CCDictionary*)pElement->getObject(); - int loops = animationDict->valueForKey("loops")->intValue(); + const CCString* loops = animationDict->valueForKey("loops"); bool restoreOriginalFrame = animationDict->valueForKey("restoreOriginalFrame")->boolValue(); CCArray* frameArray = (CCArray*)animationDict->objectForKey("frames"); @@ -193,7 +193,7 @@ void CCAnimationCache::parseVersion2(CCDictionary* animations) float delayPerUnit = animationDict->valueForKey("delayPerUnit")->floatValue(); CCAnimation *animation = new CCAnimation(); - animation->initWithAnimationFrames(array, delayPerUnit, loops); + animation->initWithAnimationFrames(array, delayPerUnit, 0 != loops->length() ? loops->intValue() : 1); array->release(); animation->setRestoreOriginalFrame(restoreOriginalFrame);