[4.1.x] Chronosv2's NESMaker Code Repository

User avatar
Posts: 258
Joined: Wed Aug 08, 2018 9:30 pm
Location: KY, USA

Re: Chronosv2's NESMaker Code Repository

Post by chronosv2 » Tue Sep 11, 2018 9:45 pm

Just looked through the code and it would require modification of more system files to pull off having a bar's background extend with its maximum. That means more changes that you lose if the HUD code gets updated at all during the NESMaker development process.
As I understand it, the HUD is one of the more complicated pieces of code, and while I have an idea of how it would work, there'd be instructions like "If your health HUD item is Element 3, go to this line, add a blank line and add this block of code. Now set the variable named ChangeMeToYourMaxHealth to the name of your max health variable."
I could still try but it'll take me a day or two and it'll be complicated to implement. Backups would be highly recommended.

The much easier way would be to make HP and MaxHP number variable hud items and do comparisons like what I do for Powerup_IncreaseWater.asm to make sure your health items don't overflow max.
There's also changes you would make to Powerup_IncreaseMaxWater.asm to make it work with a second HUD item:

Using Powerup_IncreaseMaxWater.asm to increase a 3-byte HUD item:
This code

Code: Select all

LDA MyWater1
ADC #$05
STA MyWater1
CMP #$0A
BCS +Inc10
JMP +End

INC MyWater10
LDA #$00
STA MyWater1
LDA MyWater10
CMP #$0A
BCS +Inc100
JMP +End

INC MyWater100
LDA #$00
STA MyWater10
can be changed to the AddValue macro like money uses!

Code: Select all

AddValue #$03, myMaxHealth, #$04, #$00
The reason I use such convoluted code is that in the current version (4.0.11) custom variables can be at most one byte and I can't guarantee that my variables have a contiguous space in memory so I can't use AddValue. I do use some shortcuts since I'm only using increases of 5, but AddValue still works better if you can use it!
ASM/C# Coder -- Computer + Coffee = Code
ASM Tutorial Series
My NES development projects have, for the time being, stagnated. I apologize for the inconvenience.
User avatar
Posts: 44
Joined: Sun May 31, 2020 4:11 am
Location: Brazil

Re: Chronosv2's NESMaker Code Repository

Post by Saulus_Lira » Tue Jul 28, 2020 6:57 pm

Nice! I have looking for a way to do Enemyes health hud. Maybe it works, it´s very usefull!!!
Nesmaker Making a child's dream come true :D
My Game: SUPER ADVENTURE JIh (Plataformer)
Post Reply