Consider this example:
root->runAction(CallFunc::create([&]() {
CCLOG("repeat A");
}));
Prints “repeat A”.
root->runAction(Repeat::create(CallFunc::create([&]() {
CCLOG("repeat B");
}), 1));
It should print “repeat B”, right? It’s not writing anything… Also breakpoint is not triggering.
But this:
root->runAction(
Repeat::create(
Sequence::createWithTwoActions(
CallFunc::create([&]() {
CCLOG("repeat C");
}),
DelayTime::create(0.25f)
), 1)
);
Prints “repeat C”.
Last example:
root->runAction(Repeat::create(Sequence::createWithTwoActions(
CallFunc::create([&]() {
CCLOG("repeat D");
}),
DelayTime::create(0.1f)
), 3));
Prints “repeat D” 4 times instead of 3! I’ve figured out that changing delay to 0.25f fixes the problem.
What’s going on?