O'Reilly logo

Android Game Programming by Example by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required