@arrow This is what I get for forced unwrapping, heh I assumed the first/second physics body node would always be a SKSpriteNode, but seems sometimes it isn’t for some reason. I reproduced this and fixed it by using an if let statement; I’ve updated the tutorial and sample project. Thanks for the catch!
@knagle i also see this memory leak, about 1MB per loop. If you just run the game an leave it there dying/restarting you can see it quite easily in Instruments.
@rwenderlich This is a really good tutorial. I do have a question, however.
Here is a M.W.E. and two StackOverflow related questions: Question 1, and http://stackoverflow.com/questions/41782820/swift-skspritekit-using-storyboards-uiviewcontroller-and-uibutton-to-set-in-g (sorry new users only get 2 links) using that M.W.E.
While getting your feedback on both would be great, right now question one is of more concern.
Suppose, rather than just starting the game with the GameViewController, one decides to use Main.storyboard to set up a menu, that allows one to set a difficulty and then transition to the GameViewController which brings up the GameScene.
In your tutorial, you programmatically make a SKView that, when a condition is met (30 monsters killed, or monster makes it past the screen) is shown.
In the M.W.E, how could one transition from the GameScene in GameViewController to the the UIView in the UIViewController (which has the label score)? It isn’t as straight forward (I don’t think), as showing a new view, and if one wants to pass information to the the new UIViewController (e.g. the score).
This tutorial is more than six months old so questions regarding it are no longer supported for the moment. We will update it as soon as possible. Thank you! :]