O'Reilly logo

Android Game Programming by Example by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Iteration

How can we make our game better and more playable? Let's look at a number of possibilities and then go ahead and implement them.

Multiple different enemy graphics

Let's make the enemies a bit more interesting by adding a few more graphics to the game. First, we need to add the extra graphics to the project. Copy and paste enemy2.png and enemy3.png from the Chapter4/drawables folder of the download bundle into the drawables folder in Android Studio.

Multiple different enemy graphics

enemy2 and enemy3

Now, we just need to amend the EnemyShip constructor. This code generates a random number between 0 and 2, and then switches to load a different enemy bitmap accordingly. Our completed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required