tfv: have enemy change color when dies

This commit is contained in:
Vince Weaver 2021-01-18 15:49:02 -05:00
parent d8d2afb366
commit 1b64ab5260
3 changed files with 34 additions and 6 deletions

View File

@ -8,19 +8,24 @@
do_battle:
; set start position
lda #34
sta HERO_X
lda #20
sta HERO_Y
; reset state
lda #0
sta HERO_STATE
sta MENU_STATE
sta MENU_POSITION
sta ENEMY_DEAD
; FIXME: set limit break
lda #3
sta HERO_LIMIT
; start battle count part-way in
lda #20
sta BATTLE_COUNT
@ -228,8 +233,8 @@ done_battle_handle_dead:
;========================================
; delay for framerate
; lda #10
; jsr WAIT
lda #20
jsr WAIT
@ -307,13 +312,27 @@ done_battle_count:
;========================
; check enemy defeated
; if enemy_hp zero and enemy dead < 10
lda ENEMY_DEAD
beq battle_enemy_is_not_dead_yet
battle_enemy_is_dead:
inc ENEMY_DEAD
lda ENEMY_DEAD
cmp #15
bne end_battle_loop
jsr victory_dance
jmp done_battle
battle_enemy_is_not_dead_yet:
lda ENEMY_HP_HI
bne end_battle_loop
lda ENEMY_HP_LO
bne end_battle_loop
jsr victory_dance
jmp done_battle
; make enemy dead
inc ENEMY_DEAD
end_battle_loop:

View File

@ -62,6 +62,7 @@ init_enemy:
lda #0 ; hardcode crab for now
sta ENEMY_TYPE
sta ENEMY_X
sta ENEMY_DEAD
lda #$50 ; BCD
sta ENEMY_HP_LO
@ -277,9 +278,16 @@ draw_enemy_smc1:
sta INL
draw_enemy_smc2:
lda #$a5
battle_actual_draw_enemy:
sta INH
lda ENEMY_DEAD
beq draw_enemy_alive
lda #$99
sta COLOR
jmp put_sprite_mask
draw_enemy_alive:
jmp put_sprite_crop ; tail call

View File

@ -162,6 +162,7 @@ DAMAGE_VAL_LO = $D0
MAGIC_X = $D1
MAGIC_Y = $D2
FINGER_DIRECTION= $D3
ENEMY_DEAD = $D4
COLOR1 = $E0
COLOR2 = $E1