Sprite HUD


What Modules Use the Sprite HUD?
Setting Up the Sprite HUD

Like the static HUD, the Sprite HUD is there to display important information during gameplay. This could be lives, health, currency, power ups and so on. The difference between the static HUD and the Sprite HUD is that the latter is entirely made out of sprite tiles.

The Sprite HUD is entirely code based. That means there’s nowhere in the NESmaker user interface where we can adjust how the Sprite HUD looks. All of that is done by editing the Assembly code file for the Sprite HUD. This also means that we won’t be able to see what it looks like until we start the game.


What Modules Use the Sprite HUD?

The following NESmaker modules use the Sprite HUD:

  • Brawler
  • Shooter
  • LR Platformer
  • MetroVania


Setting Up the Sprite HUD

In order to set up (or edit) the Sprite HUD we need to open the Project Settings.

From there we must choose the Script Settings tab. Then, scroll down to the Common folder icon. Select the line under it that says Handle Drawing Sprite Hud and click Edit.

This will open the Assembly code script for the Sprite HUD in whatever application you have installed that can handle .asm files. If you haven’t installed an application to handle code editing, then I recommend you do. Notepad++ is a free code editor and is often used by developers in the NESmaker community.

Let’s look at an example Sprite Hud file for the MetroVania module.

C:\NESmaker_4_5_x\GameEngineData\Routines\BASE_4_5\Game\MOD_MetroidVania\Common\doDrawSpriteHud_metroidvania.asm

In the NESmaker Assembly code files, all lines that start with a semicolon are just comments to the code, so those lines won’t be run in any way. In the example above we use the macro called DrawSpriteHud. It takes 7 arguments. The different arguments are explained in the code. In this example we are drawing two different counter bars, one for health and one for ammo. The numbers used for CONTAINER and FILLED are the sprite tiles from the GameObjectTiles.bmp tileset. We start counting the sprite tiles from the top left corner (starting at 0). Then we count to the right until we reach the end of the row, and the we continue on the following row (see picture below). The last sprite tile in the GameObjectTiles.bmp file is 127.

The last argument (arg6) in the DrawSpriteHud macro is called attribute. This can be used for several things, but in the case it’s most important to remember that it will select what subpalette to use for the sprite tiles. The way we decide what subpalette to use in code is by changing the last two values in the binary number (%00000000).

%00000000 = First subpalette


%00000001 = Second subpalette


%00000010 = Third sub-palette


%00000011 = Fourth subpalette