GameScene遵循的路径不适用于SKAction

时间:2019-07-11 03:42:44

标签: swift uibezierpath skaction skshapenode

尝试将SKShapeNode与路径一起移动,但动作开始时SKShapeNode消失:

let path = UIBezierPath()
path.move(to: CGPoint(x: currX, y: currY ))
path.addLine(to: CGPoint(x: currX + 200, y: currY))

let moveAct = SKAction.follow(path.cgPath, duration: 4.0)
newNode?.run(moveAct)

试图画一条线,它显示在正确的位置

let p = SKShapeNode(path: path.cgPath)
self.addChild(p)

如果使用操作moveTo

,它会很好地工作
let moveAct = SKAction.moveTo(x: 200, duration: 1.5)

0 个答案:

没有答案