So, I've begun working on a project in SpriteKit, and I'm hoping to be able to implement a "main menu" scene with a few buttons. One would go to a level select screen, one would be options, etc. Then from the level select screen, there would be several other buttons that when selected would start the game and load the selected level.
My question is this: how should the project be set up? Should each screen (level select, main menu, options) be its own scene and have one main view controller? Or should I have multiple view controllers for everything? Or maybe a view controller for every level (although that doesn't make too much sense) that's governed by a NavigationController in the storyboard?
After playing around with it a bit and reading online, I noticed that I can use the view controller to have UIButtons for my main menu. However, they persist through sprite kit scene changes, which is not something I would want. That would mean that I would have to set buttons to be hidden on every new scene displayed, which worries me because I'm unsure as to what exactly happens to the buttons. I know it is possible to create buttons out of SKSpriteNodes (similar to the class that Graf has posted and many people have used). Is that the better option? Instead of using UIButtons on the VC, I'd be checking whether a touch was made to that button node in the touchedBegan method and touchesEnded method, something like this:
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInNode:self];
SKNode *node = [self nodeAtPoint:location];
if ([node.name isEqualToString:@"scene button"])
{
LevelScene *scene = [LevelScene sceneWithSize:self.view.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
[self.view presentScene:scene];
}
Is this the correct way to handle it?
Eventually I will want to be able to add pause screens, game over screens, etc, and unsure if just swapping scenes will be sufficient. Furthermore, instead of having a separate implementation for each level, I could load them from a .plist file
I'm also considering the fact of whether or not I will be able to animate the buttons. I suppose I'd want them to float around or get bigger when selected (when the user has touched it but not let go), and I believe that a UIButton would not allow it since it isn't an SKSpriteNode.
Sorry for such a long post, but hopefully that gives enough information to help me out and get me on the right track! Thanks!