Author Topic: Are there specific sprites for the HUD? Or a way to alter the HUD?  (Read 4210 times)

Maverickroll

  • Posts: 1
  • Maggot Crusher.
    • View Profile
New player here, eager to jump into making my own campaigns and other little customizations. First thing I wanted to tackle was the hud you see while you play. As a usual minimalist I can see a lot of potential to make the hud more useful, less clutter, etc. Are there sprites I can edit, if so where would I locate them? (Cant seem to find anything related to the hud in the editor), if they are not sprites are there game files I can edit to do so?
« Last Edit: July 15, 2014, 09:11:37 AM by Hipshot »

Hipshot

  • Developer
  • Posts: 455
  • Level Designer
    • View Profile
Re: Are there specific sprites for the HUD? Or a way to alter the HUD?
« Reply #1 on: July 15, 2014, 09:11:24 AM »
I'm gonna make an extensive answer here soon, but I'll move this to another place first =)

Hipshot

  • Developer
  • Posts: 455
  • Level Designer
    • View Profile
Re: Are there specific sprites for the HUD? Or a way to alter the HUD?
« Reply #2 on: July 15, 2014, 10:27:36 AM »
All current hud editing elements are inside the folder called menu, inside that folder, there are several xmls, several pngs and two folders called gui and speech. The speech folder contains all speech bubbles, like the white ones or the tutorial boxes, the gui folder is the one you will be interested in if you want to change the in game hud, the menu and pretty much every menu can be changed inside here too.
You should be aware that things changed inside here won't be seen until someone actually starts the level when it's downloaded, so if you remake the start menu, no one will ever see that if you pack it into a level HWM, that needs to be released as a separate stand alone mod or such then.

I should add, that there are several limitations to hud editing too, you can't for say place a health bar on top of a players head and make that work if you're playing four people on the same machine. You should however be able to do that if you play alone or not share the screen with other players, as the camera will be centered around one player then. Things like that.



But to start of easy and make the changes you seems to be most interested in. Look at the file called menus/gui/hud.xml, that one describes how all elements are aligned on the screen and what sprites are used where, the actual sprites are defined in menus/hud.xml - I know, it's a bit confusing with those two having the same name, but I will refer to them by the colors used before here, red and blue.

So, lets change the top bar, the one that shows us information about keys and 1ups, look up the section below in hud.xml:
Code: XML
  1.                         <sprite anchor="50% 0%" offset="0 0" image="menus/hud.xml:top">
  2.                                 <text id="keys-0" offset="35 1" text="" font="menus/px-20.xml" />
  3.                                 <text id="keys-1" offset="58 1" text="" font="menus/px-20.xml" />
  4.                                 <text id="keys-2" offset="81 1" text="" font="menus/px-20.xml" />
  5.                                 <text id="lives" offset="112 1" text="" font="menus/px-20.xml" />
  6.                         </sprite>

What you do now, is to open hud.xml the one that describes the sprites, search for top (should be at the top of the xml). You will see the following:
Code: XML
  1.         <sprite scale="1" name="top">
  2.                 <texture>menus/hud.png</texture>
  3.                 <frame>200 493 154 19</frame>
  4.         </sprite>

Here you can see that in the file menus/hud.png on the co-ordinates 200 493, the top bar is located. You will also find a lot of other things here, like the coming dlc-hud, the old hud at top of the png and so on.

So, let's make the top hud slightly smaller, for this example I just moved it up a few pixels and change the Ankh icon into a mario 1up



Then you need to change the dimensions of top inside hud.xml, to fit the new graphics, in my case it should now be 154 12, instead of 154 19.

Now, if we open the game and play, you will have a smaller info bar at the top of the screen, but, ofc the text will be completely off, but if we look back into the hud.xml and the top part, there's a segment called font="menus/px-20.xml", that tells us that the text here, will be displayed using the large font of the game, if we change this into px-10.xml instead, we will get the smaller font.

Ok, so that's it for just changing the top part, it's really easy to do. It looks like shit now with my example, you would want to fix up the icons perhaps and also look into the offset values to align the text properly.

Also, look into this thread: http://hammerwatch.com/forum/index.php?topic=2080.0