gpt4 book ai didi

ios - swift-无法呈现 GameViewController 中的第二个场景

转载 作者:行者123 更新时间:2023-11-29 01:18:34 24 4
gpt4 key购买 nike

我有两个场景,GameScene 和 PlayScene。我可以展示我的 GameScene,但我无法展示 PlayScene,我使用的是相同的代码和正确的文件名。我正在使用 UIButton 来调用此函数。我什至尝试不调用 showGameScene 而只调用 goToPlayScene 但它仍然不起作用。我正在使用 GameViewController 来呈现这两个场景。

func showGameScene()
{
if let scene = GameScene(fileNamed:"GameScene") {
// Configure the view.
let skView = self.view as! SKView
/* Sprite Kit applies additional optimizations to improve rendering performance */
skView.ignoresSiblingOrder = true
/* Set the scale mode to scale to fit the window */
scene.scaleMode = .AspectFill

skView.presentScene(scene)
}
}
func goToPlayScene()
{
playButton.hidden = true
Leaderboard.hidden = true

if let scene = PlayScene(fileNamed:"PlayScene")
{
let skView = self.view as! SKView
/* Sprite Kit applies additional optimizations to improve rendering performance */
skView.ignoresSiblingOrder = true
/* Set the scale mode to scale to fit the window */
scene.scaleMode = .AspectFill

skView.presentScene(scene)
}

}

最佳答案

您是否创建了 PlayScene.sks 文件?

关于ios - swift-无法呈现 GameViewController 中的第二个场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34867793/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com