【发布时间】:2018-10-17 16:29:29
【问题描述】:
我尝试在自创类中使用 addChild:
self.addChild(chip)
错误:
Cannot convert value of type 'SKSpriteNode' to expected argument type 'UIViewController'
然后我得出结论,我不能使用self。因此我尝试以下示例:
Battlefield.addChild(chip)
战地是类名,但这里也报错:
'SKSpriteNode' is not convertible to 'Battlefield'
这可以在 GameScene 类中使用,但我如何在 Battlefield 类中做到这一点?
如果有任何答案,我将不胜感激。
【问题讨论】:
标签: swift xcode sprite-kit