3

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.

ggrr
  • 7,737
  • 5
  • 31
  • 53
MoonBIrd
  • 53
  • 4

2 Answers2

2

Use the method Which is inherited from class Node: setScaleX(-1), it works!

MoonBIrd
  • 53
  • 4
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);