Update HUD on pickup? [4.1]

Having trouble compiling code? Getting an unexpected error? Player not appearing on screen? Seeking answers on how to do a particular thing? This is the forum you're looking for, to ask other NESmaker users for assistance.
PhilJeffries
Posts: 16
Joined: Thu Feb 07, 2019 10:36 pm

Re: Update HUD on pickup? [4.1]

Post by PhilJeffries » Fri Feb 08, 2019 3:37 pm

Unless those things aren’t related, and I’m just getting lucky somehow, despite my super limited understanding of how this all works
User avatar
Elarath
Posts: 69
Joined: Fri Apr 05, 2019 6:33 am

Re: Update HUD on pickup? [4.1]

Post by Elarath » Fri Jul 19, 2019 7:47 am

dale_coop wrote:
Fri Feb 08, 2019 3:11 pm
Sometimes, the HUD doesn’t update corrcmy (for example, when 2 updates at the same time...)
Could be something like that (or maybe your player object initial health is not set to « 3 »?)

NES dev need a lot of compromises, tricks and play tests ;)
I'm going to necro this thread really quick. Is it a known issue that the hud will glitch when it updates two vars at the same time? My game will literally freeze when it happens. Is there any known work around?
Check out my game!
Light From Within
User avatar
Elarath
Posts: 69
Joined: Fri Apr 05, 2019 6:33 am

Re: Update HUD on pickup? [4.1]

Post by Elarath » Fri Jul 19, 2019 10:57 am

I believe I found the answer here

http://nesmakers.com/viewtopic.php?f=23&t=933&start=10
Check out my game!
Light From Within
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Update HUD on pickup? [4.1]

Post by dale_coop » Fri Jul 19, 2019 11:46 am

A small thing to know... there is a "bug" in NESmaker with myHealh hud and the starting screen.
When you start the game, on the starting screen, your health is not displayed correclty (it's not the myHealth value) in the HUD... instead, it's displayed full, at max.

To fix that issue:
1) modify the "HandleUpdateObjects.asm" script (in the "Basic\System\" folder), around line 193, locate those lines:

Code: Select all

			LDA #HUD_LOAD	
			AND #%01000000
			BEQ +
			STA hudElementTilesToLoad
And modify like this (adding a line of code):

Code: Select all

			LDA #HUD_LOAD	
			AND #%01000000
			BEQ +
			LDA myHealth	;;HERE <-------- fix to start with the correct hud health
			STA hudElementTilesToLoad
1) modify the script assgined to the "Hud Element 0" element in your "Project Settings > Script Settings" (it should be the HUD_Element_Var_Image.asm script), , around line 12, locate those lines:

Code: Select all

DoScreenOffHudUpdate:
	LDX player1_object
	LDA Object_health,x
	STA myHealth
And modify like this :

Code: Select all

DoScreenOffHudUpdate:
	; LDX player1_object 	;; commented out !
	; LDA Object_health,x	;; commented out !
  	; STA myHealth	;; commented out !
	LDA myHealth	;;dale_coop: fix to start with the correct hud health
Now it should display the right health value in the HUD.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
Post Reply