更新时间:2021-07-23 19:03:48
封面
Learning Java by Building Android Games Second Edition
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewer
Packt is Searching for Authors Like You
Preface
About the book
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
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
Locking the game to full-screen and landscape orientation
Deploying 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
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
Final word on OOP Classes and Objects – for now
Using Java packages
Adding classes by importing packages
Linking up our methods
Chapter 3. Variables Operators and Expressions
Handling syntax and jargon
Java Variables
Different types of variables
How to use variables
Declaring variables
Initializing variables
Making variables useful with operators
Most used operators in this book
Declaring and Initializing the Sub' Hunter Variables
Planning the variables
Declaring the variables
Handling different screen sizes and resolutions
Handling different screen resolutions part 1: Initialising the variables
Errors warnings and bugs
Printing Debugging Information
Testing the game
Chapter 4. Structuring Code with Java Methods
Methods
Methods revisited and explained further
Method Overloading by Example
Scope: Methods and Variables
Revisiting the code and methods we have used already
Generating random numbers to deploy a sub
The Random class and the nextInt method
Chapter 5. The Android Canvas Class – Drawing to the Screen
Understanding the Canvas class
Getting started drawing with Bitmap Canvas and ImageView
Using the Canvas class
Preparing the objects of classes
Initializing the objects
Setting the Activity content
Canvas Demo app
Creating a new project
Android Coordinate system
Plotting and drawing
Drawing the Sub' Hunter graphics and text
Preparing to draw
Initializing a Canvas Paint ImageView and Bitmap
Drawing some grid lines
Drawing the HUD