Add New Scenes

At the moment, Val’s Revenge uses a single game scene. Although it’s entirely possible to stuff more content and logic into this game scene, you’ll take a different approach by creating two separate classes—TitleScene and GameOverScene—each using their own scene file. The benefit of multiple scenes and classes is that your game-related logic is kept separate from the other logic. Why is this important?

Suppose you had a menu scene or a settings scene where players were able to make certain selections or change options, like the game’s sound settings or whether or not the player prefers left-sided or right-sided controls. Now imagine if you stuffed the code necessary to support these two scenes inside of the GameScene class. Before ...

Get Apple Game Frameworks and Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.