Axis-aligned bounding boxes
Checking whether two objects in our game have collided can, theoretically, be done by checking every pixel in every object and seeing whether they share a location. That logic, in addition to being very complicated to write, would be computationally extremely expensive. We need to run at 60
frames a second and can't spend our precious processing power trying to get that kind of perfection – not if we want the game to be fun, anyway. Fortunately, we can use a simplification that will be close enough to fool our silly eyes, the same way we can't tell that animation is really just a series of still images. That simplification is called the bounding box.
A bounding box is just a rectangle we'll use for collisions, instead of checking each pixel on the sprite. You can think of every sprite having a box around it, which looks like this:
![Figure 5.4 – Bounding boxes](https://static.packt-cdn.com/products/9781801070973/graphics/image/Figure_5.04_B17151.jpg)
Figure 5.4 – Bounding boxes
These boxes aren't actually...