Skip to content
Riemann edited this page Nov 20, 2013 · 4 revisions

The class that defines the HUD. Contains variables to show the Heads Up Display. It allows the player to interact with the game by use of altering the selected shot, power, and angle. It also displays available gas. See source code for further understanding.

Select Important Fields:

  • barrelAng Barrel Angle passed in from Tank
  • health Health variable to keep track of damage taken
  • shots ArrayList of available shots
  • gas Variable to show distance allowed to move
  • power Variable to control power of shot
  • hudPos Variable used to dynamically hold the position of the HUD
  • gasLength Variable for drawing gas bar.

Updates

Tank class handles all of the updates to the tank. In HUD, it updates the shown values based upon the clicks received.

Render

Render handles displaying the HUD in it's entirety. Using the variable hudPos, it arranges 6 buttons and 4 headers to Gas, Angle, Weapons, and Power. It also draws a red gas bar to indicate the amount the player is still allowed to move for that turn.

Graphical representation:

Hud

See: Source

Clone this wiki locally