Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Android Game Development

You're reading from   Learning Android Game Development A Beginner's guide to developing popular Android games

Arrow left icon
Product type Paperback
Published in May 2017
Publisher Packt
ISBN-13 9781785880957
Length 238 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nikhil Malankar Nikhil Malankar
Author Profile Icon Nikhil Malankar
Nikhil Malankar
Arrow right icon
View More author details
Toc

Creating the UI for our game


If you are not familiar with the term the UI, you must be wondering what the heck is it? UI is an abbreviation for User Interface. To put simply, a UI can consist of all the information you need to display on your game screen or your onscreen controls. Common elements of a UI include the following:

  • Text displayed on the screen
  • Buttons
  • Joystick pad
  • Tutorial instructions

In this part of our chapter, we will learn how to display text on the screen. We will also instruct the player how to play the game. We will display the following on our screen:

  • Distance ran
  • Best score
  • Instructions on how to play

So, here we have to display the best score. However, we haven't created our best score variable yet. For this part, we will work entirely in our GameView.java file. So, let's define our best score variable in this class:

private int bestScore;

We're now ready to show our UI data on the screen. Our UI will be entirely based on the draw() function, and so we will define a method called...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime