The Heads-Up Display (HUD) is a key technique that game designers use in order to provide information to the user. It's basically a set of graphics or text that are detached from the world itself and that are used to tell the player things such as how much life or mana they have left, or what their score is.
We're going to create a simple HUD that will give us really useful information such as the direction in which the character is going and its position in world coordinates. This will be enough to illustrate how to create a HUD. You will want to display more useful information in your own game. So let's go!
Create a file called
hud.lua, require it from
game.lua, and let's start our module.
Our HUD implementation ...