Chapter 5 Bringing 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: ...

Get Jump Start CoffeeScript 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.