Add the Player’s Heads-Up Display
What better way to keep a player informed than with a heads-up display (HUD). With a HUD, you’re able to display important information about the game in a way that is always visible to the player without “getting in the way” of the gameplay. At the moment, the player has no way of knowing how many keys Val has in her pocket or how much treasure she’s acquired.
In Adding New Functionality to the Player Class, you added two properties—keys and treasure—to help keep track of these important things. You’ll use these properties with your new HUD.
A lot of the code you’re about to write should be familiar to you since you’ve seen similar examples in previous chapters. So, to keep things moving along, the code explanations ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access