简体   繁体   中英

Is there any way to mirror an object using SKAction in SpriteKit?

I have an object (SKNode) that contains two other objects (SKSpriteNode).

What is the right way to mirror combined objects?

What I have:

我要镜像的图像

What I want:

我想要的图片

SKAction* action = [SKAction scaleBy:-1.0 duration:10.0];

[node runAction:action];

Pretty much the same as LearnCocos2D but I know you asked for an SKAction.

Flipping is the same as inversing scale:

theNode.xScale = -1.0;
theNode.yScale = -1.0;

Apply it to the parent node and it should flip the child nodes around the center of their parent node.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM