2015-02-08 46 views

回答

2

閉包中的參數就像一個元組,它們兩邊都需要括號。你也應該明確地解開節點的物理體(如果它可能爲零,則使用if let)。

let moveLeft = SKAction.customActionWithDuration(0.0, actionBlock: { (node: SKNode!, elapsedTime: CGFloat) -> Void in 
    node.physicsBody!.velocity=CGVector(dx: 0.5, dy: 0.5) 
}) 
+0

謝謝!!!你是搖滾樂! – Stillfinder 2015-02-08 19:19:10

相關問題