Testing the game so far

Running the game still produces a blank screen but it is well worth running it to see if there are any problems before you proceed. Just for fun, you could test the SoundEngine by adding this temporary line of code to the onTouchEvent method.

@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
   // Handle the player's input here
   // But in a new way

   mSoundEngine.playShoot();

   return true;
}

Every time you tap the screen it will play the shooting sound effect. Delete the temporary line of code and we will move on to making our game engine begin to draw things too.

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.