As games try to simulate real-world behaviors, one important aspect to simulate is physics, which dictates how Objects move and how they collide with each other, such as the collision of players and walls or bullets and enemies. Physics can be difficult to control due to the myriad of reactions that can happen after a collision, so we will learn how to properly configure it to obtain a semi-accurate Physics, which will generate the desired arcade movement feeling but get collisions working—after all, sometimes, real life is not as interesting as videogames.
In this chapter, we will examine the following collision concepts:
- Configuring Physics
- Detecting collisions
- Moving with Physics
First, we will learn how to properly configure Physics, a step needed for the collisions between Objects to be detected by our scripts, using new events we are also going to learn. Then, we are going to discuss the difference...