@naghekyan wrote:
Here is the code I use:
CallFunc* logFunc = CallFunc::create([] () { static int i = 0; CCLOG("CALL %d", i); ++i; }); Vector<FiniteTimeAction*> vec; for (int i = 0; i < 5; ++i) { vec.pushBack(logFunc); } Sequence* spAct = Sequence::create(vec); runAction(spAct);
The log is as follows:
CALL 0
CALL 1
CALL 2
CALL 3
CALL 4If I change the code to read
Sequence
asSpawn
i.e.CallFunc* logFunc = CallFunc::create([] () { static int i = 0; CCLOG("CALL %d", i); ++i; }); Vector<FiniteTimeAction*> vec; for (int i = 0; i < 5; ++i) { vec.pushBack(logFunc); } Spawn* spAct = Spawn::create(vec); runAction(spAct);
the log is the following:
CALL 0
CALL 1
CALL 2
CALL 3
CALL 4
CALL 5
CALL 6I have debugged and the fact is that first two actions in
Vector<FiniteTimeAction*> vec;
are being called twice at the end, i.e. CALL 0 and 1 are the same actions as CALL 5 and 6 correspondingly. I usecocos2d-x-3.8.1 ( September.17 2015)
so I am not sure if this bug is present in the latest version too. Please respond if you have such issues too so that we would open an issue in Github.
Posts: 4
Participants: 2