[4.1.x] Chronosv2's NESMaker Code Repository

chronosv2

New member
Hey there folks. This thread was originally just about my Long HUD Bars code, but now that I've released more code to my repository I figured it's time to convert it. All the instructions for use that used to be here are now in readme files in the repository.
https://github.com/chronosv2/NESMaker_Public_Code_Repository

Included in the Repository:
  • Long HUD Bars (ADVANCED)
  • Number Splitting / Enemy HP Display
  • Countdown Timer (Water Gauge)
  • Increasing Maximums (Used with Water system)
  • Recovery Tile (Used with Water system)
  • ChangeToWalkingAnimation Moving Animation State Check (useful if you want to have movement after attacking so the animation doesn't keep getting reset)

HUDExample.gif

All code in this repository is free for anyone to use however they see fit. I just wanted to make something cool for the community. :D
 

Orgia Mode

New member
Hey! Wow! This is excellent! I was sad that I couldn't do this earlier to have 10 HP/MP but I compromised for 8. Now it would be a little too much trouble for me to add a new element just for 2 extra HP/MP blocks.
 

Bucket Mouse

Active member
This is amazing! Awesome work.

It sounds like you have to permanently alter the code to make it possible though. If you ever planned to make a game with short HUD elements again, you'd need to make a copy of the software as-is...or am I wrong?
 

chronosv2

New member
Technically, yes, but that's why I made the HUD Code modification a single import line.
A single semicolon before that .include line and the code no longer exists in the ROM, and no longer takes up space. That and if you ever want rid of it for good it's just as quick to take out and no trace of it will exist.

Edit:
The reason you have to modify a core engine file is that due to the complexity of the HUD code, it can only update one element at a time. A long bar requires multiple elements, so I've got to slot in the second value after the first HUD item gets updated so it will have the values it needs to update the second.
 

chronosv2

New member
Just a small post to let everyone know I've added more scripts to my repository and changed this thread to be about the repo as a whole. Anybody with issues regarding my code can either ask me here or as Issues on GitHub if they so desire!
 
Haven't dug into it yet, but I imagine it would be easy enough to modify your increase Max Water to an increase Max Health, eh?
 

chronosv2

New member
That shouldn't be hard to modify. You'd just have a user variable for max health and raise it. Then your health check makes sure grabbing health doesn't put you over max.
Though now I wonder if there's a way to control how many empty bars draw for a health bar. I'll have to test that out later today.
 

chronosv2

New member
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:
LDA MyWater1
ADC #$05
STA MyWater1
CMP #$0A
BCS +Inc10
JMP +End

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

+Inc100:
INC MyWater100
LDA #$00
STA MyWater10
can be changed to the AddValue macro like money uses!
Code:
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!
 
Top Bottom