Creating the classes for our boundaries

Before actually creating our boundaries, we will need an image sprite in order to make them visible on the screen. For this purpose, we will take a simple sprite with a plain color. Here's the sprite that we will be using for our game:

Our ground.png file

Also, we will place this file in our res/drawable folder as we did for our previous image files. Once you are done with this, move on to the next part.

So now, let's create our UpperBoundary.java class. Go ahead, create a new class and write the following code in it:

public class UpperBoundary extends GameObj {    private Bitmap img;    public UpperBoundary(Bitmap ...

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.