Chapter 13
Game Physics
In the Painter game, you created a very basic mechanism for objects moving around in the game world and colliding with each other. In Tut’s Tomb, this is no longer sufficient. Objects need to fall according to gravity, they need to bounce off walls, and they need to handle collisions differently. In this chapter, you are going to adapt your game structure so that it is more suitable for these advanced interactions. You will see that it’s quite simple to add physically correct behavior to your game objects in SpriteKit.
A Basic Class for Game Objects
Most games have a complicated structure of game objects. First, there might be a background consisting of various layers of moving objects (mountains, air, trees, and so ...
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