1
我正在做一個精靈軌道上的點,併爲我做的,後面是精靈的路徑:遵循的路徑逆
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))
這一工程和精靈開始軌道圍繞該點。問題是,當用戶觸摸屏幕時,我希望精靈開始逆時針旋轉。對於我寫了相同的代碼的最後一行順時針旋轉,但編輯於:
base1?.runAction(SKAction.repeatActionForever(follow1).reversedAction())
但問題是,雖然它逆時針旋轉,精靈圖像翻轉水平。我能做些什麼來避免這種情況?或者還有什麼其他方式通過一個點來繞過精靈?