From d9020b3788847d9c692d892241ba574863905238 Mon Sep 17 00:00:00 2001 From: Marco Tillemans Date: Wed, 21 Sep 2011 12:44:13 +0200 Subject: [PATCH 1/2] Issue 1247, repeatforever not correctly updated When a action was finished the delta for the next run was calculated incorrectly. CCRepeat and CCRepeatForever now behave identically when run with the same action. --- cocos2d/CCAction.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos2d/CCAction.m b/cocos2d/CCAction.m index f098195065c..0bf62337359 100644 --- a/cocos2d/CCAction.m +++ b/cocos2d/CCAction.m @@ -158,10 +158,11 @@ -(void) step:(ccTime) dt { [innerAction_ step: dt]; if( [innerAction_ isDone] ) { - ccTime diff = dt + innerAction_.duration - innerAction_.elapsed; + ccTime diff = innerAction_.elapsed - innerAction_.duration; [innerAction_ startWithTarget:target_]; // to prevent jerk. issue #390 + [innerAction_ step: 0.0f]; [innerAction_ step: diff]; } } From 21e72be5b7e5847e82c8dd52f0a17b5b7a2b6326 Mon Sep 17 00:00:00 2001 From: Marco Tillemans Date: Wed, 21 Sep 2011 14:02:03 +0200 Subject: [PATCH 2/2] Small addition to mention issue # in code --- cocos2d/CCAction.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2d/CCAction.m b/cocos2d/CCAction.m index 0bf62337359..1649cfba961 100644 --- a/cocos2d/CCAction.m +++ b/cocos2d/CCAction.m @@ -161,7 +161,7 @@ -(void) step:(ccTime) dt ccTime diff = innerAction_.elapsed - innerAction_.duration; [innerAction_ startWithTarget:target_]; - // to prevent jerk. issue #390 + // to prevent jerk. issue #390, 1247 [innerAction_ step: 0.0f]; [innerAction_ step: diff]; }