Book Image

Learning Java by Building Android Games - Second Edition

By : John Horton
Book Image

Learning Java by Building Android Games - Second Edition

By: John Horton

Overview of this book

Android is one of the most popular mobile operating systems presently. It uses the most popular programming language, Java, as the primary language for building apps of all types. However, this book is unlike other Android books in that it doesn’t assume that you already have Java proficiency. This new and expanded second edition of Learning Java by Building Android Games shows you how to start building Android games from scratch. The difficulty level will grow steadily as you explore key Java topics, such as variables, loops, methods, object oriented programming, and design patterns, including code and examples that are written for Java 9 and Android P. At each stage, you will put what you’ve learned into practice by developing a game. You will build games such as Minesweeper, Retro Pong, Bullet Hell, and Classic Snake and Scrolling Shooter games. In the later chapters, you will create a time-trial, open-world platform game. By the end of the book, you will not only have grasped Java and Android but will also have developed six cool games for the Android platform.
Table of Contents (30 chapters)
Learning Java by Building Android Games Second Edition
Contributors
Preface
Index

Setting up Android Studio


Setting up Android Studio is quite straightforward if a little lengthy. Grab some refreshment and get started with the following steps.

  1. Visit developer.android.com/studio/index.html. Click the big green button to proceed.

  2. Accept the terms and conditions by checking the box and then click the big blue button DOWNLOAD ANDROID STUDIO FOR WINDOWS.

  3. When the download is completed run the file you just downloaded. It has a name that starts android-studio-ide… the end of the name of the file will vary based on the current version at time of reading.

  4. Click the Next button to proceed.

  5. Leave the default options selected as shown next and click the Next button.

  6. Next, we need to choose where to install Android Studio as shown in the next image.

    The install wizard recommends 500mb, however there are more requirements later in the install process. It is much easier if you have all your Android Studio parts as well as your project files on the same hard drive. I recommend having at least 2gb of free space. If you need to switch drives to accommodate this, then use the Browse.. button to browse to a suitable place on your hard drive.

    Note

    Write down a note of where you choose

  7. When you are ready click the Next button.

  8. In this next window you are choosing the folder in your start menu where Android Studio will appear. Leave it at the default as shown next.

  9. Click Install.

  10. This step might take some time, especially on older machines or if you have a slow Internet connection. When this stage is done you will see this screen.

  11. Click Next.

  12. Android Studio is now installed, check the Start Android Studio check-box and click the Finish button.

  13. You will be greeted with the Welcome screen as shown next.

  14. Click the Next button.

  15. Choose Standard install type as shown next.

  16. Click the Next button.

  17. Choose whichever color scheme looks nice to you, I chose InteliJ as shown next.

  18. Click Next.

  19. Now you will see the Verify Settings screen.

  20. Click the Finish button. Android Studio will now commence some more downloads, they could take some time.

  21. When Android Studio is ready you will have the option to run Android Studio. At this point click the Finish button. Android Studio is ready- probably. You can leave it open if you are carrying straight on with the next section or you can close it and then reopen it when instructed in the next section.

Final step

Using your preferred file manager software, perhaps Windows Explorer, Create a folder called AndroidProjects. Make it at the root of the same drive where you installed Android Studio. So, if you installed Android Studio at C:/Program Files/Android then create your new folder as C:/AndroidProjects.

Or if you installed Android Studio at D:/Program Files/Android then create your new folder as D:/AndroidProjects.

Note

Note that the screen shots in the next section show the AndroidProjects folder on the D: drive. This is because my C: drive is a bit full-up. Either is fine. Keeping it on the same drive as the Android installation is neater and could avoid future problems so do so if you can.

Note

Notice that there is no space between the words Android and Projects and that the first letter of both words is capitalized.