Collision detection

At the end of Chapter 4Getting Started - Object Placement, we added static objects, but I guess many of us started wondering how can we make these objects interact with the player. 

In order to do this, we have to start by adding collision to the object we want to interact with; whatever interactions we are looking for, the collision must always be a component of the object. As we read before, the components in charge of the collision are colliders, which could be the following:

  • Box collider 2D
  • Circle collider 2D
  • Capsule collider 2D
  • Tilemap collider 2D

We will have to click on one of the static objects we added in the previous chapters. In order to show a better example, I will add an AlienBlock01 to the scene and ...

Get Hands-On Game Development without Coding 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.