简体   繁体   English

SpriteKit中同时包含两个场景

[英]Two scenes at the same time in SpriteKit

I need to have a game scene, and on the bottom a permanent game menu for things like inventory, etc. I thought it would be great to have two scenes: one for the actual game and another for the game menu. 我需要有一个游戏场景,在底部有一个永久性的游戏菜单,用于库存之类的东西。我认为最好有两个场景:一个用于实际游戏,另一个用于游戏菜单。 How can I do this in SpriteKit? 如何在SpriteKit中做到这一点? Having two scenes at the same time (and each one having its own nodes and such) 同时具有两个场景(每个场景都有其自己的节点等)

Also, if this is not the best way to implement this, please tell me. 另外,如果这不是实现此目标的最佳方法,请告诉我。

No don't do that. 不,不要那样做。 Even if possible it is meaningless. 即使可能,也没有意义。

In a such case I use storyboard. 在这种情况下,我使用情节提要。 Created menu at top of the screen and give the rest of the screen to SKView . 在屏幕顶部创建了菜单,并将屏幕的其余部分提供给SKView By this way you can control your SKScene easily also you can use UIKit for you menu which is more advanced than SpriteKit ui elements. 通过这种方式,您可以轻松控制SKScene也可以使用UIKit菜单,该菜单比SpriteKit ui元素更高级。

Also you can use one scene and create menu nodes with SpriteKit utilities. 您还可以使用一个场景并使用SpriteKit实用程序创建菜单节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM