Collision management
In the previous section of this chapter, we learned the most important techniques to perform actions on nodes, namely movements. Now that everything is moving, we need a way to detect when the main character tries to cross a closed door (a wrong door) or an open one (a correct door).
Detecting and handling collisions is one of the main techniques in game development, as a vast percentage of games is founded upon enemies trying to hit our character in many different ways or the player trying to kill the enemies by shooting them, jumping at them, and so on. But, what is a collision?
Understanding collisions
In game development, a collision is an intersection between two or more elements in a scene. There are different ways to detect ...
Get Getting Started with SpriteKit now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.