Dale, thanks for all your help so far! I'm also dealing with HUD health issues and I can't find a fix in the forums.
HUD starting health=5, max health=5, player max health=5. HUD displays health, keys, currency. Everything but health works fine. I'm testing on screens with no triggers.
Always, one health pickup will max out my health.
Sometimes, when I kill a monster, my health recovers to max health (instantly, without a drop).
Sometimes, when I kill a monster, my health exceeds the max by 1-3.
Sometimes, when I'm hurt, I lose 1-4 health (monster strength is at default:0).
Rarely, when I'm hurt i receive more than 1 damage, the HUD shows 1 heart, then four blanks, then four hearts. the next attack kills me
Sometimes, when I change screens I lose 1-3 health.
I'm using modified Powerup_Health script:
Code:
;;; Increase Health code for player.
;;; works with variable myHealth
;;; works with HUD variable HUD_myHealth.
LDA myHealth
CLC
ADC #$01
CMP #$04
TXA
STA tempx
;;;you may want to test against a MAX HEALTH.
;;; this could be a static number in which case you could just check against that number
;;; or it could be a variable you set up which may change as you go through the game.
inc myHealth
LDA myHealth
LDX player1_object
STA Object_health,x
;;; we also need to set up the routine to update the HUD
;; for this to work right, health must be a "blank-then-draw" type element.
STA hudElementTilesToLoad
LDA #$00
STA hudElementTilesMax
; LDA DrawHudBytes
; ORA #HUD_myHealth
; STA DrawHudBytes
UpdateHud HUD_myHealth
LDX tempx
;;; we also need to set up the routine to update the HUD
;; for this to work right, health must be a "blank-then-draw" type element.
STA hudElementTilesToLoad
LDA #$00
STA hudElementTilesMax
LDA DrawHudBytes
ORA #HUD_myHealth ;; <<--- HERE Your Pickup-related Variable
STA DrawHudBytes
How should I approach this?