In cocos2dx, I use the class skeletonAnimation
to create the skeleton animation which uses the resources exported by spine. We know the class skeletonAnimation
is the subclass of node not is sprite.
How to do to make the skeleton animation flip the node as it like to use the method setFlippedX()
in sprite node.
Asked
Active
Viewed 1,603 times
3
2 Answers
0
I had created methods to flip the skeleton animation.
void setFlipX(bool flipX) {
if(flippedX != flipX) {
flippedX = flipX;
flippedX ? setScaleX(-getScaleX()) : setScaleX(getScaleX());
}
}
void setFlipY(bool flipY) {
if(flippedY != flipY) {
flippedY = flipY;
flippedY ? setScaleY(-getScaleX()) : setScaleY(getScaleX());
}
}
and call the it as:
spinefile->setFlipX(true);
spinefile->setFlipY(true);

James Louis
- 41
- 4