SpriteKit includes a fully functional physics engine. It is easy to implement and very useful, as most mobile game designs require some level of physical interaction between game objects. In our game, we want to know when the player runs into the ground, an enemy, or a power-up. The physics system can track these collisions and execute our specific game code when any of these events occur. SpriteKit's physics engine can also apply gravity to the world-as well as the bounce and spin that can occur when sprites collide with each other-and creates realistic movement through impulses; and it does all of this before every single frame is drawn on the screen!
The topics in this chapter include the following:
Adopting a protocol for consistency
Organizing game objects into classes
Adding the player's character
Renovating the GameScene class
Physics bodies and gravity
Exploring physics simulation mechanics
Movement with impulses and forces
Bumping bees into bees