我现在遇到的问题是我无法解决转换延迟问题。我发现当我第一次尝试从标题场景转换到GameScene
时,场景不会平滑过渡并且滞后。我猜测它是由于加载SKSpriteNodes
和纹理。
当我从项目中的didMoveToView
中删除下面的代码时,转换将顺利进行,但有没有办法让转换顺利进行而不删除它们?因为我刚接触SWIFT& spritekit一些提示或示例会有所帮助!我很乐意听到你的消息!
//setting up the score related materials
scoreLabel.text = "x 0"
scoreLabel.fontSize = 20
scoreLabel.horizontalAlignmentMode = .Left
scoreLabel.fontColor = SKColor.whiteColor()
scoreLabel.position = CGPoint(x:self.size.width/6, y: self.size.height-35)
self.addChild(scoreLabel)
scoreLabel.zPosition = 2
let pt = SKSpriteNode(imageNamed: "points")
pt.position = CGPoint(x:self.size.width/9, y: self.size.height-25)
self.addChild(pt)
pt.zPosition = 2
let life = SKSpriteNode(imageNamed: "life")
life.position = CGPoint(x: self.size.width/2, y: self.size.height-25)
self.addChild(life)
life.zPosition = 2
//setting up the Misses related materials
missLabel.text = "x 3"
missLabel.fontSize = 20
missLabel.horizontalAlignmentMode = .Left
missLabel.fontColor = SKColor.whiteColor()
missLabel.position = CGPoint(x: self.size.width/2 + life.size.width, y: self.size.height-35)
self.addChild(missLabel)
missLabel.zPosition = 2