Book Image

Learning Android Game Development

By : Nikhil Malankar
Book Image

Learning Android Game Development

By: Nikhil Malankar

Overview of this book

In this book, we’ll start with installing Android studio and its components, and setting it up ready for Android N. We teach you how to take inputs from users, create images and interact with them, and work with sprites to create animations. You’ll then explore the various collision detection methods and use sprites to create an explosion. Moving on, you’ll go through the process of UI creation and see how to create buttons as well as display the score and other parameters on screen. By the end of the book, you will have a working example and an understanding of a 2D platform game like Super Mario and know how to convert your 2D games to 3D games.
Table of Contents (17 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
4
Creating Sprites and Interactive Objects

Learning about the 3D coordinate system


While making our 2D game, we were only dealing with x and y axis values. However, when you are making a 3D game, you have to deal with three axis values: x, y, and z. We're pretty much clear how our x and y axis values work by now. In a similar way, our z axis is projected on the front and back of our mobile device. The following image will explain the three axes in our 3D coordinate system better:

The positive x, y, and z axis on phone

The axes you see in the preceding image are positive directions. If you take their opposite sides, you will get negative values. The origin point starts from (0,0,0), and your values can be float values that will denote your object's location in 3D space.

Here's a classic problem that you might encounter while dealing with OpenGL in terms of device screen sizes. The grid in OpenGL assumes a screen, which is square and has a uniform coordinate system. However, if your screen size varies, then a non-square screen is considered...