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.

block collision detection collision detection Up against the wall

Figure 5.1. Up against the wall

The principle behind our block collision code goes like this: starting from ...

Get Jump Start CoffeeScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.