Android is one of the most popular mobile Operating systems presently. It uses the Java programming language. The problem is that most Android books assume the reader is already proficient with Java. This new and expanded second edition of Learning Java by Building Android Games shows you how to start building Android games from scratch. The ...;Cover; Copyright; Contributors; Table of Contents; Preface; Chapter 1: Java, Android and Game Development; What's new in the second edition?; Why Java, Android and Games?; Java: The first stumbling block; The games you will build; Sub' Hunter; Pong; Bullet Hell; Snake Clone; Scrolling Shooter; Open-World Platformer; How Java and Android work; Setting up Android Studio; Final step; Starting the first project: Sub' Hunter; Extra step 1; Extra step 2; Android Studio and our project -- A very brief guided tour; The Project panel; The Editor window Get ready for a fun-filled experience of learning Java by developing games for the Android platform Key Features Learn Java, Android, and object-oriented programming from scratch Build games including Sub Hunter, Retro Pong, Bullet Hell, Classic Snake, and a 2D Scrolling Shooter Create and design your own games, such as an open-world platform game Book Description 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 doesnt 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 youve 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. What you will learn Set up a game development environment in Android Studio Implement screen locking, screen rotation, pixel graphics, and play sound effects Respond to a players touch, and program intelligent enemies who challenge the player in different ways Learn game development concepts, such as collision detection, animating sprite sheets, simple tracking and following, AI, parallax backgrounds, and particle explosions Animate objects at 60 frames per second (FPS) and manage multiple independent objects using Object-Oriented Programming (OOP) Understand the essentials of game programming, such as design patterns, object-oriented programming, Singleton, strategy, and entity-component patterns Learn how to use the Android API, including Activity lifecycle, detecting version number, SoundPool API, Paint, Canvas, and Bitmap classes Build a side-scrolling shooter and an open world 2D platformer using advanced OOP concepts and programming patterns Who this book is for Learning Java by Building Android Games is for you if you are completely new to Java, Android, or game programming and want to make Android games. This book also acts as a refresher for those who already have experience of using Java on Android or any other platform without game development experience. Table of Contents Java, Android & Games Java Basics & An Introduction to Object Oriented Programming - Starting the Sub Hunter Game Java Variables, Operators, Expressions and Android Debugging - Spawning a Sub to Hunt Making Decisions with Java If, Else & Switch - Getting the Player's Input The Android Canvas Class, Drawing to The Screen - Firing Depth Charges While, Do While, For Loops, Break & Continue - Enhancing Sub Hunter Game Java Methods - Finishing Sub Hunter Game Object Oriented Programming - Starting the Pong Game Interfaces, Threads & Exce Cover Copyright Contributors Table of Contents Preface Chapter 1: Java, Android and Game Development What's new in the second edition? Why Java, Android and Games? Java: The first stumbling block The games you will build Sub' Hunter Pong Bullet Hell Snake Clone Scrolling Shooter Open-World Platformer How Java and Android work Setting up Android Studio Final step Starting the first project: Sub' Hunter Extra step 1 Extra step 2 Android Studio and our project -- A very brief guided tour The Project panel The Editor window Locking the game to full-screen and landscape orientationDeploying the game so far Running the game on an Android emulator Running the game on a real device Summary Chapter 2: Java: First Contact Planning the Sub' Hunter game Actions flowchart/diagram Code comments Mapping out our code using comments Introduction to Java methods Overriding methods Structuring Sub' Hunter with methods Introduction to Object Oriented Programming Classes and Objects The important thing about OOP, Classes, and Objects Classes, objects, and instances Final word on OOP, Classes, and Objects -- for nowUsing Java packages Adding classes by importing packages Linking up our methods Summary Chapter 3: Variables, Operators and Expressions Handling syntax and jargon Java Variables Different types of variables Primitive types Reference variables How to use variables Declaring variables Initializing variables Making variables useful with operators Most used operators in this book Casting Concatenation Declaring and Initializing the Sub' Hunter Variables Planning the variables Declaring the variables Handling different screen sizes and resolutionsHandling different screen resolutions part 1: Initialising the variables Errors, warnings, and bugs Printing Debugging Information Testing the game Summary Chapter 4: Structuring Code with Java Methods Methods Methods revisited and explained further The method signature Modifier Return type A closer look at method names Parameters Doing things in the method body Method Overloading by Example Creating a new project Coding the method overloading mini-app Running the method overloading mini-app Scope: Methods and Variables Revisiting the code and methods we have used alreadyGenerating random numbers to deploy a sub The Random class and the nextInt method Adding Random based code to newGame Testing the game Summary Chapter 5: The Android Canvas Class -- Drawing to the Screen Understanding the Canvas class Getting started drawing with Bitmap, Canvas, and ImageView Canvas and Bitmap Paint ImageView and Activity Canvas, Bitmap, Paint and ImageView quick summary Using the Canvas class Preparing the objects of classes Initializing the objects Setting the Activity content Canvas Demo app Get ready for a fun-filled experience of learning Java by developing games for the Android platform 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. Learning Java by Building Android Games is for you if you are completely new to Java, Android, or game programming and want to make Android games. This book also acts as a refresher for those who already have experience of using Java on Android or any other platform without game development experience. (N.B. Please use the Look Inside option to see further chapters) "Android is one of the most popular mobile operating systems. It uses the most popular programming language, Java, as the primary language for building apps of all types. Unlike others, this book doesn't assume that you that you already have Java proficiency. This new and expanded second edition of Learning Java by Building Android Games teaches you to build Android games from scratch. The difficulty level will grow steadily as you explore key Java topics, such as variables, loops, 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, and Classic Snake. In the concluding 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 6 cool games for the Android platform."--Back cover