Configure the Physics Bodies
In Chapter 8, Using the Scene Editor to Add Physics, you used the Scene Editor to add a physics body to the player node. However, as you start to build out Val’s Revenge, keeping track of the physics categories can (and will) get a little tricky. While it’s entirely possible to use only the Scene Editor, setting up the physics bodies like you did for the player node, you have another option: use components and extensions.
Unlike the physics code you wrote in Configure Physics Categories, where you simply set up a single enum to hold the physics categories using a UInt32 type, you’ll instead expand that idea and use a combination of String enums and protocols. You’ll also create and use a new physics component ...
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.