Reusing the Pong engine

Feel free to copy and paste all the code in this section. It is nearly identical to the structure of the Pong game. What will vary is the other classes we will create (Bullet and Bob) as well as the way that we handle player input, timing, updating and drawing within the BulletHellGame class.

As you proceed with this section glance over the code to notice subtle but important differences which I will also point out to you as we proceed.

Coding the BulletHellActivity

Paste and examine this code into the BulletHellActivity class.

import android.app.Activity; import android.graphics.Point; import android.os.Bundle; import android.view.Display; // This class is almost exactly // the same as the Pong project public class BulletHellActivity ...

Get Learning Java by Building Android Games - Second Edition 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.