Updating our boundaries

We will be updating our upper boundaries on every 50th score and lower boundaries on every 40th score. Let's write the code for our boundaries. This involves a lot of tricky mathematical calculations, so watch out. However, contradictory to that, every step is quite self-explanatory here. Here's the base logic for our boundaries:

  1. Update on every 50th or 40th score
  2. Add our image onto the screen
  3. After every frame, call the update() method in our boundary class
  4. If the boundary goes out of screen, then remove it
  5. If either of the boundary exceeds its maximum or minimum value, then accordingly set its upBound or lowBound variable to either true or false, depending on its position

This is the logic for our boundaries, and ...

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.