I'm making a sprite to orbit a point and for that I made a path that is followed by that sprite:
let dx1 = base1!.position.x - self.frame.width/2
let dy1 = base1!.position.y - self.frame.height/2
let rad1 = atan2(dy1, dx1)
path1 = UIBezierPath(arcCenter: circle!.position, radius: (circle?.position.y)! - 191.39840698242188, startAngle: rad1, endAngle: rad1 + CGFloat(M_PI * 4), clockwise: true)
let follow1 = SKAction.followPath(path1.CGPath, asOffset: false, orientToPath: true, speed: 200)
base1?.runAction(SKAction.repeatActionForever(follow1))
That works and the sprite starts to orbit around that point. The thing is that when the user touches the screen I want that sprite to start rotating counterclockwise. For that I write the same code for rotating clockwise but editing the last line to:
base1?.runAction(SKAction.repeatActionForever(follow1).reversedAction())
But the problem is that although it rotates counterclockwise, the sprite image flips horizontal. What can I do to avoid that? Or is there any other way to orbit a sprite through a point?
A straightforward way to rotate a sprite about a point (i.e., orbit) is to create a container node, add a sprite to the node at an offset (relative to the container's center), and rotate the container node. Here's an example of how to do that: