Add Physics to the Player
You can move players (and enemies) around the scene in many ways. In Gloop Drop, you used actions. In Val’s Revenge, you’ll use the physics engine to move Val, the main character of the game. But before you can do that, you first have to set up a physics body for the player sprite node.
In Chapter 4, Working with Physics and Collision Detection, you learned the ins and outs of using the physics engine, including how to write code to set up the different physics bodies and properties. Now it’s time to learn how to set up physics using the Scene Editor.
Open the GameScene.sks file and select the player sprite node. Look at the Attributes Inspector and scroll down to the Physics Definition section. Switch the Body Type ...
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