Chapter 11. Things That Go Bump – Part II
The collision detection in this game is much more complex than the previous two. For this reason, the code will be quite heavily commented. Sometimes the comments will explain things in a bit more detail or in a slightly different way.
However, that doesn't mean it needs to be hard work. What we need to do is take a moment to consider a strategy that will work for us.
Hopefully, this approach will mean that by the end of the chapter, our collision detection solutions will appear straightforward.
Planning for collision detection
What we are trying to achieve can be put into the following two categories:
- What we want for the border:
- Asteroids, bullets, and the ship need to know when they have collided with the ...