5

I just started to learn SceneKit/SpriteKit to develop games, and while I understood the game part (the SCNScene, in my case), I’m not so sure about the menu/hud part.

What I want to do: create an Inventory Screen to show the items the player has in his bag. This screen will appear when the user taps the bag Icon in the HUD. Furthermore, the Inventory Screen must have a UICollectionView-like list to show each item.

Game Hud: http://i.imgur.com/duldmoG.jpg

Inventory Screen: http://i.imgur.com/nxaJdQO.jpg

My question is: should I mix SpriteKit with UIKit to try to accomplish this? Or use just one of them? Should everything be done just with SKScenes that are shown on top of each other (by adding to the OverlaySKScene)?

Currently, I’m presenting the HUD as a SKScene (OverlaySKScene). When the user taps the bag icon, I’m loading a new SKScene (with a bunch of SKSpriteNodes, SKShapeNodes etc) and putting it as the current OverlaySKScene. Now, I’m trying to do the CollectionView part, but don’t know if I should try to implement everything from scratch with SpriteKit or if it’s possible to reuse UICollectionView, with my SKScene as a delegate.

I'm not sure if the way I'm doing is the right way, either.

Any help would be appreciated. Thanks in advance.

Quentin Hayot
  • 7,786
  • 6
  • 45
  • 62
  • I would go for UIKit, presenting new viewcontroller from gameviewcontroller and using collection view and other UI Items and creating a singleton class to store and handle inventory changes. – Abhi Sep 28 '15 at 12:11
  • I ended up going for UIKit for more complex screens, and using the overlaySKScene just to present the HUD. I'm still on the early stages of the development, but it seems that this will work. Currently, going back to the GameViewController (from the new ViewController) randomly lowers the fps from 60 to 40, but it seems to be the same problems as in [link](http://stackoverflow.com/questions/32821033/inconsistent-scenekit-framerate). – Marcel Rebouças Oct 03 '15 at 02:05
  • 1
    Example for future SO readers of how to use `overlaySKScene` as described in this question: http://stackoverflow.com/a/35726298/885189 – JaredH Mar 01 '16 at 15:15

0 Answers0