Idea and suggestion to make sprite flips in Spriter-cocos2d-x with Spriter tool

Idea and suggestion to make sprite flips in Spriter-cocos2d-x with Spriter tool
0.0 0


I experiment with framework to do skeleton animation recently and finally found a good tool to use which is Spriter ( In fact I knew this for the time it’s launched but not pay much attention to it back then.

Then I started to look around the web for a framework to be able to work with that tool in cocos2d-x.
First I found this which the framework is kind of solid in its sense (although the author noted in the source code that it’s kind of dirty of implementation) and think right away that I should port this into c*+ unless no one else already done it.
Fortunately I found that has done the job. The latest source code used cocos2d-x 2.0.2 and is a port version from spriter-cocos2d project I mentioned.

So enough of the story.
My question is that after tested the framework, I’ve found a problem and in need for ideas or suggestion to make the sprite flip as the implementation should be based from that project itself.
I target to make flipping in x-axis works first as in y-axis is not in priority but if x-axis works y-axis should not be too difficult.
I’ve tested it by adding a setter method to modify the flipping flag of each individual CCSprite inside SpriterNode , but the result is not as expected due to the way each sprite positioned relative to the some point . Thus when you flip, it just positions there but only flip the image. This behavior is correct in the sense of single sprite as we all do most of the time. But when in the situation like this that we have multiple of sprites to represent a character, it’s not the same.

  • Any ideas* suggestion on how to implement it would be great.
  • Anyone uses this framework + Spriter tool and found any better solution to make it works on cocos2d-x, I would love to hear it as well.


I hope I understand the problem correctly, but maybe you can set a different anchor point? Or change the position when flipped?


Thanks I got it to work now!

I have to apply –1 to scaleX, x-position, and rotation of each sprite node.


I added improvement to original project made my young20 especially flipping in x-axis. I blogged it out + video example previewing what changed here


I run your example. It works on Iphone but doesn’t work on android :frowning:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000408882 in SpriterAnimation::getMainline (this=0x0) at …/Classes/SpriterNode.cpp:312
312 return _mainline;


Honestly, I forked this out from young40 (original author) and I don’t have chance to test on android and PC, I’m really sorry.
Maybe you would like to fix it if you like.

I don’t maintain it now due to decision to not using it for my current project.