Book Image

Game Development with Swift

By : Stephen Haney
Book Image

Game Development with Swift

By: Stephen Haney

Overview of this book

Table of Contents (18 chapters)
Game Development with Swift
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Learning the SpriteKit collision vocabulary


SpriteKit uses some unique concepts and terms to describe physics events. If you familiarize yourself with these terms now, it will be easier to understand the implementation steps later in the chapter.

Collision versus contact

There are two types of interactions when physics bodies come together in the same space:

  • A collision is the physics simulation's mathematical analysis and repositioning of bodies after they touch. Collisions include all the automatic physical interactions between bodies: preventing overlap, bouncing apart, spinning through the air, and transferring momentum. By default, physics bodies collide with every other physics body in the scene; we have witnessed this automatic collision behavior in our game so far.

  • A contact event also occurs when two bodies touch. Contact events allow us to wire in our custom game logic when two bodies come into contact. Contact events do not create any change on their own; they only provide us with...