We’re back on track, at least it’s safe to say that. Let’s jump right into the core.
Bug that plagues us for months
The first thing I really want to say is “Bug”. As cocos2d-x is an action-based framework in which case if you want to do something, you fire up new actions or cached ones. It goes like that not so similar to state-based or intensive update-loop approach that you need to keep track of the current state and act immediately upon that.
Things get complicate as there are several actions in both major types as follows.
- Translation & Misc
Those two are combined and packed up together in one final action (or CCAction) in which you use it as a parameter in runAction() of particular CCNode.
Consider this case when Kiki hits a target zombie with a hard punch, a zombie would then be bounced back for a reasonable distance due to punching force and at the same time it plays an underattack animation. When it hits the ground or says logically it finishes translating for that bouncing back distance then the animation should change into falling (or down) then after some short amount of time it wakes up and goes back into normal (or stand) animation.
That’s pretty much the concept of one such the whole chain of action trigger what’s behind the scene to start working. Let’s imagine if something in parallel or very close in proximity of time along with that executing action just starts and ready to roll in, then we have a chance to break the whole things going on if something won’t finish gracefully and completely. You know we have to stop previous action before start a new one, thus this leads to stop the whole thing as I mentioned previously.
This kind of situation might occur if that kind of action involves spinning in mid-air.