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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access