-
Book Overview & Buying
-
Table Of Contents
Android Game Programming By Example
By :
We need to start making our game a bit more rounded. Games have a score or, in our case, a time, and other rules as well. For the player to keep check on their progress we need to display the stats of the game.
Here, we will quickly set up a HUD that will show the player everything they need to know on screen while he is dodging enemies. We will also declare and initialize the variables required to supply data to the HUD. In the next section, Implementing the rules, we can begin to manipulate variables such as, shields, time, fastest time, and so on.
We can start by adding some member variables to the TDView class. We use a float value for the distanceRemaining variable because we will be using pseudo-kilometers and fractions of kilometers to represent the distance remaining until our hero makes it to her home planet. For the timeTaken, timeStarted, and fastestTime variables, we will use the long type because time is represented in milliseconds and the values get really big...
Change the font size
Change margin width
Change background colour