0
在我的SpriteKit遊戲的標題畫面中,我想要有一個SKLabelNode
顯示「Play」。但是,當我運行下面的代碼時,節點不會添加到場景中。SKLabelNode未在SKScene中創建 - Swift
import UIKit
import SpriteKit
class TitleScreen: SKScene {
var title: SKLabelNode!
override func didMoveToView(view: SKView) {
backgroundColor = SKColor(colorLiteralRed: 0.4, green: 0.835, blue: 1, alpha: 1)
//The color is a light blue, so the node should not be hidden by the color of the screen.
title = SKLabelNode()
title.text = "Play"
title.color = SKColor.blackColor()
title.fontSize = 70
self.addChild(title)
}
我該怎麼做才能做到這一點?
驗證didMoveToView被調用 – Knight0fDragon