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 ...

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