Skip to content

Commit 631ab9c

Browse files
committed
cocos2d-js#1165: Made Sequence taken account of the repeat _times attribute
1 parent 1ac1d6b commit 631ab9c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cocos2d/actions/CCActionInterval.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,10 @@ cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{
423423
* @param {Number} dt
424424
*/
425425
update:function (dt) {
426-
dt = this._computeEaseTime(dt);
427426
var new_t, found = 0;
428-
var locSplit = this._split, locActions = this._actions, locLast = this._last;
427+
var locSplit = this._split, locActions = this._actions, locLast = this._last, actionFound;
428+
429+
dt = this._computeEaseTime(dt);
429430
if (dt < locSplit) {
430431
// action[0]
431432
new_t = (locSplit !== 0) ? dt / locSplit : 1;
@@ -456,15 +457,17 @@ cc.Sequence = cc.ActionInterval.extend(/** @lends cc.Sequence# */{
456457
}
457458
}
458459

460+
actionFound = locActions[found];
459461
// Last action found and it is done.
460-
if (locLast === found && locActions[found].isDone())
462+
if (locLast === found && actionFound.isDone())
461463
return;
462464

463465
// Last action found and it is done
464466
if (locLast !== found)
465-
locActions[found].startWithTarget(this.target);
467+
actionFound.startWithTarget(this.target);
466468

467-
locActions[found].update(new_t);
469+
new_t = new_t * actionFound._times;
470+
actionFound.update(new_t > 1 ? new_t % 1 : new_t);
468471
this._last = found;
469472
},
470473

0 commit comments

Comments
 (0)