Summary
We have done a lot of theory in this chapter – everything from the mathematics of detecting collisions to learning how the RectF
class has the intersects
method that can handle rectangle intersections for us. We also looked closely at the SoundPool
class, including how we can detect which version of Android the player is using and vary our code accordingly. Initializing a SoundPool
object also brought us into contact with method chaining, where we can call multiple methods on the same object in a single line of code. Finally, we used all this knowledge to complete the Pong game.
Perhaps the best thing is that now we have all this experience and theory behind us, we will now (starting in the next chapter) be able to quickly complete the next game in just two chapters, at the same time as learning about Java arrays, which will help us to handle lots of data.