chronicleroflegends
Member
So I have tracked down an issue, but I am not sure quite how to solve it.
I have 2 different player attacks.
Standard attacks do 1 dmg
Kicks do 3 dmg
This is my slightly modified code for doing damage/checking if the monster is dead:
The problem arises here:
Monster has 2 health remaining,
Player kicks monster - subtract 3 health
Monster now has -1 health.
Compare accumulator to 01
BCC checks if health is less than 01 and branch to death
When it compares 1 to -1 I am getting FALSE.
Same goes for any more negative numbers.
Basically, if the damage I do to a monster puts their health below zero, they become invincible. So I guess BCC doesn't account for negative numbers.
Is there a way I can rewrite the check to account for if the number is negative?
I have 2 different player attacks.
Standard attacks do 1 dmg
Kicks do 3 dmg
This is my slightly modified code for doing damage/checking if the monster is dead:
Code:
LDA Object_health,x
SEC
SBC #PLR_KICKDMG
CMP #$01
BCC killMonster_SR
STA Object_health,x
RTS
The problem arises here:
Monster has 2 health remaining,
Player kicks monster - subtract 3 health
Monster now has -1 health.
Compare accumulator to 01
BCC checks if health is less than 01 and branch to death
When it compares 1 to -1 I am getting FALSE.
Same goes for any more negative numbers.
Basically, if the damage I do to a monster puts their health below zero, they become invincible. So I guess BCC doesn't account for negative numbers.
Is there a way I can rewrite the check to account for if the number is negative?