Book Image

Learning Java by Building Android Games

By : John Horton
Book Image

Learning Java by Building Android Games

By: John Horton

Overview of this book

Table of Contents (17 chapters)
Learning Java by Building Android Games
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The memory game


The code in the memory game shouldn't challenge us too much because we have done the background research on threads, arrays, sound, and persistence. There will be some new-looking code and we will examine it in detail when it crops up.

Here is a screenshot of our finished game:

This is the home screen. It shows the high score, which persists between play sessions and when the device is shut down. It also shows a Play button, which will take the player to the main game screen. Take a look at the following screenshot:

The game screen itself will play a sequence of sounds and numbers. The corresponding button will wobble in time with the corresponding sound. Then the player will be able to interact with the buttons and attempt to copy the sequence. For every part of the sequence that the player gets right, they will be awarded points.

If the sequence is copied in its entirety, then a new and longer sequence will be played and again the player will attempt to repeat the sequence...