我用Google搜索了问题并尝试了以下内容:
但我仍然在iphone 6上的xcode模拟器上获得黑条。
我的游戏控制器看起来像这样:
k
我的Gamescene
import UIKit
import SpriteKit
class GameViewController: UIViewController {
var scene : GameScene!
override func prefersStatusBarHidden() -> Bool {
return true
}
override func viewDidLoad() {
super.viewDidLoad()
let skView = view as! SKView
skView.showsFPS = true
scene = GameScene(size: skView.bounds.size)
scene.scaleMode = .AspectFill
skView.presentScene(scene)
}
}
和我的第一级
import SpriteKit
class GameScene: SKScene {
required init?(coder aDecoder:NSCoder){
super.init(coder: aDecoder)
}
override init(size: CGSize){
super.init(size: size)
var tempText = SKLabelNode(fontNamed: "Copperplate")
tempText.position = CGPoint(x: self.size.width / 2, y: self.size.height / 2)
tempText.text = "Click anywhere to play"
tempText.fontSize = 20
addChild(tempText)
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
var newScene = LevelOne(size: size)
var transition = SKTransition.crossFadeWithDuration(2)
view?.presentScene(newScene, transition: transition);
}
}
任何建议将不胜感激。我是swift和spriteKit的新手,所以我不知道自己哪里出错了。