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 and, 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 live online training, plus books, videos, and digital content from nearly 200 publishers.