Book Image

Learning Java by Building Android Games - Third Edition

By : John Horton
5 (1)
Book Image

Learning Java by Building Android Games - Third Edition

5 (1)
By: John Horton

Overview of this book

Android is one of the most popular mobile operating systems today. It uses the most popular programming language, Java, as one of the primary languages for building apps of all types. Unlike most other Android books, this book doesn’t assume that you have any prior knowledge of Java programming, instead helps you get started with building Android games as a beginner. This new, improved, and updated third edition of Learning Java by Building Android Games helps you to build Android games from scratch. Once you've got to grips with the fundamentals, the difficulty level increases steadily as you explore key Java topics, such as variables, loops, methods, object-oriented programming (OOP), and design patterns while working with up-to-date code and supporting examples. At each stage, you'll be able to test your understanding by implementing the concepts that you’ve learned to develop a game. Toward the end, you’ll build games such as Sub Hunter, Retro Pong, Bullet Hell, Classic Snake, and Scrolling Shooter. By the end of this Java book, you'll not only have a solid understanding of Java and Android basics but will also have developed five cool games for the Android platform.
Table of Contents (24 chapters)

Deploying the game so far

Before we can properly explain any of the code and learn our first bit of Java, you might be surprised to learn that we can already run our project. It will just be a blank screen, but as we will be running the game as often as possible to check our progress, let's learn how to do that now. You have three options:

  • Run the game on the emulator on your PC (this is part of Android Studio).
  • Run the game on a real Android device in USB debugging mode.
  • Export the game as a full Android project that can be uploaded to the Play Store.

The first option is the easiest to set up because we did it as part of setting up Android Studio. If you have a powerful PC, you will hardly see the difference between an emulator and a real device. However, screen touches are emulated by mouse clicks, so proper testing of the player's experience is not possible.

The second option that uses a real device has a couple more steps; however, once it is...