1
我做錯了什麼?我似乎無法弄清楚這一點。我曾嘗試把一個感嘆號後面的標記:var thisBlock = self.childNodeWithName(block)
,'SKNode?'沒有一個名字爲'position'的會員
這給了我一個新的錯誤說。 type() does not confirm to protocol 'BooleanType'.
func blockRunner() {
for(block, blockStatus) in self.blockStatuses {
var thisBlock = self.childNodeWithName(block)
if blockStatus.shouldRunBlock() {
blockStatus.timeGapForNextRun = random()
blockStatus.currentInterval = 0
blockStatus.isRunning = true
}
if blockStatus.isRunning {
if thisBlock.position.x = blockMaxX{
thisBlock.position.x -= CGFloat(self.groundSpeed)
} else {
thisBlock.position.x = self.origBlockPositionX
blockStatus.isRunning = false
self.score++
if ((self.score % 5) == 0) {
self.groundSpeed++
}
self.scoreText.text = String(self.score)
}
} else {
blockStatus.currentInterval++
}
}
}
你想做什麼? – 2014-11-02 13:39:08
childNodeWithName返回一個SKNode,而SKNode沒有名爲position的屬性。 thisBlock是SKSpriteNode嗎? – 0x141E 2014-11-05 03:07:35