Example
Working example (notice: .repeat(1);
const sequence1 = cc.sequence(
cc.moveBy(1, cc.p(0, -300)),
cc.moveBy(1, cc.p(0, 300))
).repeat(1);
const sequence2 = cc.sequence(
cc.callFunc(() => {
cc.log('first');
}),
cc.callFunc(() => {
cc.log('ready');
}));
this.node.runAction(
cc.sequence(
sequence1,
sequence2
)
)
When you change to repeat(2)
the durations of the cc.moveBy
will actually be 0.5s instead of 1. If you do .repeat(4);
the cc.moveBy
duration will be 0.25… etc.
This means the animation will always run in 2 seconds and it does move it the amount of repeated times but with more speed.
If you put repeat(10) or such it will go insanely fast since it has to go through 10 times in still 2 seconds, even though every duration of the cc.moveBy
should be 1 second (with 10 repeats total of 20 seconds). This fast movement also leads to next bug that is below.
Another bug is also that if you cc.moveBy
too fast you will lose position and even though you move things up and down the same amount, they won’t end up in the same position where they started, even though it should. Would like to know solutions for that as well.
Thanks!