Adding boundaries

As we are quite familiar with the process of creating a new class, we will simply create our two new classes for our upper and lower boundary and call them UpperBoundary.java and LowerBoundary.java, respectively. We have the following objectives for our boundaries:

  • Make them appear at the top and bottom of our game screen
  • If a player collides with them, then reset the game

With these objectives in mind, we will move ahead to create boundaries for our game.

Get Learning Android Game Development 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.