Chapter 5Bringing a Game to Life
This chapter is going to apply all that we’ve learned, rigorously and unrelentingly. We have a long day ahead of us: block collisions, entity collisions, gravity, ladders, AI, collectibles, digging, and building. It seems like a forest of features but, thankfully, our base lets us easily add them one tree at a time.
Block Collision Detection
Our levels are ephemeral at the moment; pretty pictures in the background with no effect on our players. We need some collision detection, as evident in Figure 5.1.
Figure 5.1. Up against the wall
The principle behind our block collision code goes like this: starting from ...