(Possible Bug) HUD not updating until player leaves the screen [NoScroll core]

Rustocrat

New member
Hi, me again. I'll get this figured out one of these days, I swear.

So now that I have monsters in my game, I've noticed that when they do damage to the player, my heart meter doesn't update until I leave the screen.

I have my starting value on myHeath set to 2 on both my HUD and my Player and I do die in two hits like I should, but my HUD doesn't update whenever I take damage.

Anybody else noticing this?
 

dale_coop

Moderator
Staff member
You're using the 4.1.5? How is your Handle Player Hurt script? Have you made any modification? Could you share the content of your script?
 

Rustocrat

New member
Yeah, I'm using 4.1.5. I haven't made any modifications to the script (that I know of).

Code:
notPlayerDeath:
	STA Object_health,x
	STA myHealth
	
	STA hudElementTilesToLoad
		LDA #$00
		STA hudElementTilesMax
		; LDA DrawHudBytes
		; ora #HUD_myHealth
		; STA DrawHudBytes
	UpdateHud HUD_myHealth
    ;; TURN ON handling the hud
	
	LDA Object_status,x
	ORA #%00000001
	STA Object_status,x	

	LDA #HURT_TIMER
	STA Object_timer_0,x
	ChangeObjectState #$00,#$02 ;; uses idle for hurt state.
	
	LDA selfCenterX
	STA recoil_selfX
	LDA selfCenterY
	STA recoil_selfY
	LDA otherCenterX
	STA recoil_otherX
	LDA otherCenterY
	STA recoil_otherY
	
	JSR DetermineRecoilDirection


	;;;;; SCROLLER CAN NOT MAKE USE OF UPDATING HUD THIS WAY.


	
doneWithPlayerHurt:
 

Rustocrat

New member
And I just checked my script settings, yes this is the .ASM file that Handle Player Hurt points to.
 

dale_coop

Moderator
Staff member
Ok... In your HUD, your health is displayed as var tiles (small hearts)?
What module are you using Adventure/ScrollingPlatform/SimplePlatform/Maze/Shooter?
 

dale_coop

Moderator
Staff member
Strange, works fine for me (basic_adventure module, 2 hearts hud myHealth var, player has his health to 2). When a monster hit me I looses instanly one heart on the hud.
Have you made any modification in your "Handle Object Collision" script?
 

dale_coop

Moderator
Staff member
You have this issue each time your player is hurt by a monster, or sometimes it works correctly?
 

dale_coop

Moderator
Staff member
Like if the Update Hud couldn't execute... blocked by somehting else.
Your Hud is full of elements? a timer? Your screen full of monsters/NPC/pickup/...?
 

Rustocrat

New member
I mean, my HUD is kinda full. I think I'm using all but one element.

game-000.png
 

Rustocrat

New member
Nothing too extreme on the screen though. No timer, really nothing custom. The screen I was testing it on had two monsters and each was an 8x8 square sprite.
 

dale_coop

Moderator
Staff member
Oh, yes, of course, I knew all that. Sorry, Rustocrat :p
Recenlty I fixed so many projects that I've forgotten which one is whose :p

...strange.
Could you share again your project ? I could check tonight about this issue.
 

Rustocrat

New member
So if anyone else wants to know how this issue resolved, here's a copy-and-paste of Dale Coop's messages to me. This fix works just fine for me:

1/ Modify your "HandleUpdateObjects.asm" script (in the "Routines\Basic_NoScroll\System\" folder), line 192...
Before:

Code:
BEQ +
LDA Object_health,x
STA hudElementTilesToLoad

After:

Code:
BEQ +
LDA Object_health,x		;; <<-- load the correct Health value
STA hudElementTilesToLoad

2/ Modify your "MainsASM.asm" script (in the "Routines\Basic_NoScroll\" folder):
Line 301, uncomment the line:
Before

Code:
;	JSR HandleHudData

After:

Code:
	JSR HandleHudData

AND line 306, uncomment the line:
Before

Code:
;	JSR CheckForUpdateScreenData

After:

Code:
	JSR CheckForUpdateScreenData

3/ Modify your "HandleUpdateObjects.asm" (in the "Routines\Basic_NoScroll\System\" folder), around line 190, just BEFORE the "LDA #HUD_LOAD" line, add this code:

Code:
LDA screenFlags
AND #%00000001	;; if hide_hud for the screen
BNE +			;; we don't need to update the hud
;; else the normal code drawing the health hud:
			
LDA #HUD_LOAD

You're welcome ;)
 
Top Bottom