Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Android Game Programming By Example
  • Table Of Contents Toc
Android Game Programming By Example

Android Game Programming By Example

By : John Horton
4.4 (9)
close
close
Android Game Programming By Example

Android Game Programming By Example

4.4 (9)
By: John Horton

Overview of this book

The book is best suited for existing Android or Java programmers who want to adapt their skills to make exciting Android games. The book is also for determined readers who might have no Android, game programming or even Java experience, but a reasonable understanding of object oriented programming knowledge is assumed.
Table of Contents (13 chapters)
close
close
7
7. Platformer – Guns, Life, Money, and the Enemy
12
Index

Scores and the HUD


The HUD objects will never be rotated. In addition, they are defined in the InputController class based on screen coordinates, not the game world or even Open GL coordinates. Therefore, our GameObject class is not a suitable parent class.

For the sake of simplicity, each of the three HUD classes will have their own draw method. We will see how we draw them at a consistent size and screen position using a new viewport matrix.

Once we have created all three of our HUD classes, we will add all of the object declarations, initializations, and drawing code.

Adding control buttons

The first HUD object we will make a class for, is a simple button.

Note

I am showing all the imports explicitly, as they do not get imported automatically. Note that the next two classes will need these as well. The code is all in the download bundle as usual, if you wish to just copy and paste it.

Create a new class and call it GameButton, then add the following import statements. Be sure to state the correct...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Android Game Programming By Example
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon