O'Reilly logo

Android: Game Programming by Raul Portales, 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

Chapter 8

Q1) What about a visual improvement for our game screen, perhaps a nice, light green grassy background instead of just black?

A) You can use most graphics programs such as Gimp or Photoshop to get the RGB value of a nice, light green grassy color. Alternatively, you can use an online color picker such as http://www.colorpicker.com/. Then look at this line in our drawGame method:

canvas.drawColor(Color.BLACK);//the background

Change it to the following line:

canvas.drawColor(Color.argb(255,186,230,177));//the background

Q2) How about adding some nice flowers to the background?

A) Here is the way to do this. Create a flower bitmap (or use mine), load it, and scale it in the usual way, in the configureDisplay method. Decide how many flowers to ...

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