Organize the Project

Up until now, you’ve been adding files and building Val’s Revenge with very little consideration to the project’s overall organization. While you may think this isn’t a problem—I mean, it’s only a sample game, right?—keeping things organized (regardless of the “what for”) helps reduce confusion and frustration, especially when working on your own games. In other words, it doesn’t matter if you’re learning how to use a game framework or building a full-fledged dungeon crawler—you should follow the same best practices for project organization regardless.

To begin, open the valsrevenge project in Xcode.

In the Project Navigator, select the valsrevenge group and create a new group (N). Name this new group Extensions, and then move the SKScene+ViewProperties.swift, GameScene+ViewUpdates.swift, and SKTileMapNode+Physics.swift files into the newly created group.

Just above the Extensions group, create another new group (N) and name this one Reference Nodes. Move the Controller.sks and AttackButton.sks files into the newly created Reference Nodes group.

You’re almost done, hang in there—you have two more groups to create. Name the first new group Scenes and place it above the Reference Nodes group. Move the GameScene.sks and GameScene.swift files into the new Scenes group.

Finally, create the last new group, naming it Tile Sets, and then move the MainTileSet.sks into the Tile Sets group.

To further organize your project, move the GameViewController.swift file and the Assets.xcassets catalog above the Tile Sets group. When you start adding additional resources, like music and sound files, having all of the audio and visual assets grouped at the top of the project, along with the main view controller, is helpful.

Excellent, you’re ready to add some resources.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset