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

Why build games to learn to program?


Fun, of course! But there are other reasons too. Successfully running any program we have written is immensely satisfying, even more so when it involves using some code that we previously didn't understand.

But making our own games, as you will soon realize, creates a feeling of pleasure that is not easy to describe—it has to be experienced. Then there are added bonuses of sharing our creations with friends on a phone or tablet or even sharing them publicly on the Google Play Store, and you might realize that once you start making games, you can't stop.

As we create more complex games steadily, you'll realize that all techniques and pieces of code can be rehashed to create other games, and you can then start planning your very own unique masterpieces. This is exhilarating to say the least.

And as with many subjects, the more we practice the better we get. So games are a perfect way to start learning to program Java. However, most beginners' books for Android games require a fairly high level of Java knowledge. But as we will see, it is perfectly possible to keep the practical examples as fun game projects and still start with the very basics of Java.

There is a slight trade-off in doing things this way. We will not always approach the working game examples in a "by-the-book" manner. This is to avoid the problem of doing cartwheels before mastering the forward roll.

The learning outcome priority will always be the Java programming concept, followed by understanding the Android environment and game design principles. Having said that, we will closely examine and practice plenty of Android and game programming fundamentals.

Of course, from what we have just discussed, you can probably surmise that it would have been possible to teach a bit more Java in the same number of pages if we hadn't been making games.

This is true, but then we lose all the benefits that come with using games as the subject matter. Making games really can be a joy, and when our brains are open and eager for information, we will learn much faster. The minimal overhead of learning this way is negated a hundred times over. If games don't interest you in the slightest, then there are plenty of Java beginners' guides out there that take the traditional approach. Just don't expect quite the same thrill as when you publish your first game with online leaderboards and achievements.