I’ve got a little problem in my game. Sometimes, I need to call setFlippedX and runAction, to change the appearance of the player (like, when doing a new action, like walking toward a new direction).
this.stopAllActions(); this.setFlippedX(this.animationSequencesFlippedX[this.currentAnimationKey]); this.runAction(cc.RepeatForever.create(this.animationSequences[this.currentAnimationKey]));
The setFlippedX instruction flips the sprite horizontally, and the runAction one changes the player current action / animation. The problem with this is that both instructions are not executed at the same time, and for a split second, you can see the previous animation getting flipped, THEN the new animation appears.
In case it’s not clear, you can check out the bug here: http://stifu.fr/cc/Whip-A-Wimp/
Move the player to the left, then go up ot down. As you go up/down, you’ll see very briefly the previous frame (looking left) be flipped, before the new animation appears.
How can I fix this? Can I freeze the sprite drawing or something, so that the sprite won’t be repainted until I’m done updating it, or something like that?