Drawing our boundaries on the screen

As with our previous images, we use the draw() method to write our code for displaying our ground on the screen:

for(UpperBoundary ub : upperBoundary){    ub.draw(canvas);}for(LowerBoundary lb: lowerBoundary) {    lb.draw(canvas);}

Even this part is taken care of for now. Now, we have to look at the collision part of our ground. We need to detect a collision on our ground with the player. 

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.