How to build a multilevel game in SceneKit

风流意气都作罢 提交于 2019-12-06 06:50:01

问题


I'm an iOS developer and have plenty of business apps done. Some time ago I decided to try and write a 3D game for iPad using SceneKit. I understand how to create SCNView and SCNScene instances and how to load my scene from .dae files, but I'm having trouble understanding scene transition logic.

Could someone explain the logic of transitioning between different game levels in SceneKit. I haven't found any transition methods between SCNView and SCNScenes

For example: I have 2 levels of game (SCNScene instances). After the player finishes playing the first level, I show the score view (SpriteKit overlay probably), and after that I want to load player character adding stats (for example). After all that, the second level of the game should show.

What architectural concept works in SceneKit for loading different levels in succession? Should I transition between SCNView or do I need to use a basic transition between view controllers (i.e., 2 levels packed in different View Controllers with a SCNView in each)?.

And if I have the scenes: "Main Menu", "In-App Purchase Store", "Select Player Hero", etc, what concept should I use to transition between the game scene and these?.

So far all examples I have seen are based around a 1-scene game ("Banana", "Fox Apple" WWDS examples).

I would appreciate any help/info/links that will help me to understand. Thank you.


回答1:


On iOS 9 and OS X 10.11 there's a new method on SCNSceneRenderer that does what you want: -presentScene:withTransition:incomingPointOfView:completionHandler:.

On previous versions you can indeed build a transition in SpriteKit and display it in the overlay SpriteKit scene while reconfiguring the SceneKit scene. Or you could use UIKit and use animations to swap between two views.



来源:https://stackoverflow.com/questions/32801550/how-to-build-a-multilevel-game-in-scenekit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!