【发布时间】:2015-12-05 21:09:34
【问题描述】:
我正在尝试使用 SpriteKit 为 iPhone 制作 iPod Classic 的游戏 Vortex(https://www.youtube.com/watch?v=LPN-vdeEsiE) 版本。我有这段代码,以便平台围绕中心运行:
let dx = base!.position.x - self.frame.width/2
let dy = base!.position.y - self.frame.height/2
let rad = atan2(dy, dx)
path = UIBezierPath(arcCenter: circle!.position, radius: (circle?.position.y)! - 191.39840698242188, startAngle: rad, endAngle: rad + CGFloat(M_PI * 4), clockwise: true)
let follow = SKAction.followPath(path.CGPath, asOffset: false, orientToPath: true, speed: 200)
base?.runAction(SKAction.repeatActionForever(follow))
但问题是节点的 zPosition 指向路径而不是中心,如您所见here。
请有人帮我解决这个问题,我将不胜感激。谢谢
【问题讨论】:
标签: ios sprite-kit uibezierpath