Mildanner
Member
Original Guide by Mildanner (ft. RetroKoH)
In game development, the developers didn't know how to make a simple scrolling HUD and decided to make the HUD pop in the screen without any doubts. In this guide, you will learn how to make a simple scrolling HUD.
First, you search for this variable v_ssangle in your disassembly _Variables.asm and find that UNUSED line code under it.
You can simply create a variable for the HUD scrolling, just replace it with this:
If that step didn't work, let's move it into a fewer unused RAM byte.
First, you will go to the _Variables.asm to find that variable with fewer unused bytes. Good example is v_ssbganim, you will find this UNUSED code part.
Replace it with this
If you are using only 1 byte for the HUD's scrolling variable, we should go above v_obj31ypos (Being a good example) and find this UNUSED code part.
Replace it simply with this
Note: You should include only one variable for the HUD's scrolling, including duplicate will give you a error. Just go in a preference you wish to do, 1 byte or 2 bytes.
After you created a variable, you should go to the _incObj/21 HUD.asm and go at the routine HUD_Main and replace it entirely with this new routine:
Optional: You can change the scrolling speed to what you want, just simply replace the 5 with the number you think it's better.
If the code mentioned in particular doesn't work, you did some mistake! Just go ahead in HUD_Index: label and add this line under HUD_Flash-HUD_Index
Having issues with that scrolling? You can just clear it everytime it goes in Title Screen, go to GM_Title and find this piece of code:
Above it, you can just place this code underneath it.
Did you like it? Now your hack's HUD is scrolling like how it would be.
(OPTIONAL) Adding sound effect if HUD is in the position
So, if you want a sound effect that simply plays when the HUD is moved at the correct position, just go to the ".reached" label and add this below the label:
In game development, the developers didn't know how to make a simple scrolling HUD and decided to make the HUD pop in the screen without any doubts. In this guide, you will learn how to make a simple scrolling HUD.
First, you search for this variable v_ssangle in your disassembly _Variables.asm and find that UNUSED line code under it.
Code:
ds.b $C ; unused
Code:
ds.b $A ; unused
ds.b 1 ; Reserved for the level start flag (if you want the S2 HUD and/or S2 Rings)
v_hudscrollpos: ds.b 1 ; Scrolling x-position for the HUD
First, you will go to the _Variables.asm to find that variable with fewer unused bytes. Good example is v_ssbganim, you will find this UNUSED code part.
Code:
ds.b 2 ; unused
Code:
v_hudscrollpos: ds.b 2 ; Scrolling x-position for the HUD
Code:
ds.b 1 ; unused
Code:
v_hudscrollpos: ds.b 1 ; Scrolling x-position for the HUD
After you created a variable, you should go to the _incObj/21 HUD.asm and go at the routine HUD_Main and replace it entirely with this new routine:
Code:
HUD_Main: ; Routine 0
addq.b #4,obRoutine(a0) ; Advances to Routine 4 (HUD_Move) on the next frame
move.w #0,obX(a0) ; Starts the HUD offscreen (X = 0)
move.w #$108,obScreenY(a0)
move.l #Map_HUD,obMap(a0)
move.w #ArtTile_HUD,obGfx(a0)
move.b #0,obRender(a0)
move.b #0,obPriority(a0)
rts
HUD_Move: ; Routine 4
move.w obX(a0),d0 ; Loads the current HUD X position
cmpi.w #$90,d0 ; Has it reached position $90?
bge.s .reached ; If greater or equal, finalize the movement
addq.w #5,d0 ; Move 5 pixels to the right
move.w d0,obX(a0) ; Update the object's X coordinate directly
jmp DisplaySprite
.reached:
move.b #2,obRoutine(a0)
jmp DisplaySprite
If the code mentioned in particular doesn't work, you did some mistake! Just go ahead in HUD_Index: label and add this line under HUD_Flash-HUD_Index
Code:
dc.w HUD_Move-HUD_Index
Having issues with that scrolling? You can just clear it everytime it goes in Title Screen, go to GM_Title and find this piece of code:
Code:
bsr.w ClearScreen
Code:
clr.b (v_hudscrollpos).w ; clear scroll counter
(OPTIONAL) Adding sound effect if HUD is in the position
So, if you want a sound effect that simply plays when the HUD is moved at the correct position, just go to the ".reached" label and add this below the label:
Code:
move.b #sfx_Cash,d0 ; set cash sound to be played
jsr QueueSound2 ; play it
NOTE: Not all implementations in code like this can work and be aware before using this code.
Last edited: