I... really don't know what I did wrong. Just look at this: https://youtu.be/tB0YpU2Uj1o
It happens both when player get hurt and healed in my game. This is my health powerup script. The only thing I've changed was the max health comparison value. No idea what's wrong but it also happens when player gets hurt. Doesn't happen if the health is displayed as a number.
It happens both when player get hurt and healed in my game. This is my health powerup script. The only thing I've changed was the max health comparison value. No idea what's wrong but it also happens when player gets hurt. Doesn't happen if the health is displayed as a number.
Code:
;;; Increase Health code for player.
;;; works with variable myHealth
;;; works with HUD variable HUD_myHealth.
LDA myHealth
CLC
;ADC #$01
CMP #$06
BCS skipGettingHealth
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
LDX tempx
skipGettingHealth:
PlaySound #sfx_1up