したがって、SpriteKit テンプレートを使用してプロジェクトを作成する場合。ビュー コントローラーと SKScene があります。
ビュー コントローラーから、デフォルトで指定されたコードを使用してゲームを開始し、シーンを表示します。
私のTCAViewcontroller.mで
- (IBAction)startGame:(id)sender {
NSLog(@"Start Game triggered");
mainPageImage.hidden = 1;
// Configure the view.
// Configure the view after it has been sized for the correct orientation.
SKView *skView = (SKView *)self.view;
if (!skView.scene) {
skView.showsFPS = YES;
skView.showsNodeCount = YES;
// Create and configure the scene.
TCAMyScene *theScene = [TCAMyScene sceneWithSize:skView.bounds.size];
theScene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:theScene];
}
}
ユーザーがゲームで負けたら、シーンを閉じて、持っているビュー コントローラーに戻りたいと思います。ゲームオーバーシーンにプッシュするだけで、元のView Controllerに戻るための検索で何も見つからないようです。しかし、別のシーンにプッシュしたくありません。現在のシーンを閉じて、TCAViewController に戻ります。明確にするためにコードを使用して答えてくださいありがとう