我試圖自己將SKSpriteNodes添加到函數的視圖中,但Xcode不會允許我這樣做。它給了我爲什麼我不能在func中使用自我Swift
func indicate() {
if test == 0 {
var large = ((CGFloat(largest)*54) - 29) - selectedNode.position.x
var small = selectedNode.position.x - ((CGFloat(smallest)*54) - 29)
indicatorRight.position = CGPointMake(selectedNode.position.x + large, selectedNode.position.y)
indicatorRight.userInteractionEnabled = true
indicatorRight.zPosition = 0.5
indicatorLeft.position = CGPointMake(selectedNode.position.x - small, selectedNode.position.y)
indicatorLeft.userInteractionEnabled = true
indicatorLeft.zPosition = 0.5
println(indicatorLeft.position)
// println(smallest)
self.addChild(indicatorRight)
self.addChild(indicatorLeft)
}
}
什麼是包含內的指示功能?這是一堂課嗎? –
該功能出現在什麼外部環境中? – Tommy
它不是在一個班級或任何東西。 – Nas5296