2021-01-17 21:14:56 +00:00
|
|
|
|
|
|
|
;=========================
|
|
|
|
; attack
|
|
|
|
;=========================
|
|
|
|
attack:
|
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
2021-01-18 20:35:12 +00:00
|
|
|
lda #20
|
|
|
|
sta HERO_Y
|
2021-01-17 21:14:56 +00:00
|
|
|
|
2021-01-18 04:43:56 +00:00
|
|
|
lda #$00
|
|
|
|
sta DAMAGE_VAL_HI
|
2021-01-17 21:14:56 +00:00
|
|
|
lda #$10
|
2021-01-18 04:43:56 +00:00
|
|
|
sta DAMAGE_VAL_LO
|
|
|
|
|
2021-01-17 21:14:56 +00:00
|
|
|
|
|
|
|
attack_loop:
|
|
|
|
|
|
|
|
; copy over background
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
; draw hero
|
|
|
|
|
2021-01-18 20:35:12 +00:00
|
|
|
lda HERO_Y
|
2021-01-17 21:14:56 +00:00
|
|
|
sta YPOS
|
|
|
|
lda HERO_X
|
|
|
|
sta XPOS
|
|
|
|
|
2021-01-18 20:35:12 +00:00
|
|
|
; walk/run alternate frames
|
2021-01-17 21:14:56 +00:00
|
|
|
lsr
|
|
|
|
bcc attack_draw_walk
|
|
|
|
|
|
|
|
attack_draw_stand:
|
2021-01-18 20:35:12 +00:00
|
|
|
jsr draw_hero_and_sword
|
|
|
|
jmp attack_done_draw
|
2021-01-17 21:14:56 +00:00
|
|
|
|
|
|
|
attack_draw_walk:
|
2021-01-18 20:35:12 +00:00
|
|
|
jsr draw_hero_walk_and_sword
|
2021-01-17 21:14:56 +00:00
|
|
|
|
|
|
|
|
2021-01-18 20:35:12 +00:00
|
|
|
attack_done_draw:
|
2021-01-17 21:14:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; draw enemy
|
|
|
|
|
|
|
|
lda ENEMY_X
|
|
|
|
sta XPOS
|
|
|
|
; ypos already 20?
|
|
|
|
|
|
|
|
jsr draw_enemy
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
; draw battle bottom
|
|
|
|
|
|
|
|
jsr draw_battle_bottom
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
; page flip
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
dec HERO_X
|
|
|
|
lda HERO_X
|
|
|
|
cmp #10 ; repeat until 10
|
|
|
|
bne attack_loop
|
|
|
|
|
2021-01-18 20:35:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-01-17 21:14:56 +00:00
|
|
|
;======================
|
|
|
|
; attack done
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; damage the enemy
|
|
|
|
|
|
|
|
jsr damage_enemy
|
|
|
|
|
|
|
|
; display damage
|
|
|
|
|
|
|
|
lda #2
|
|
|
|
sta XPOS
|
|
|
|
lda #10
|
|
|
|
sta YPOS
|
|
|
|
jsr gr_put_num
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; page flip
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; delay
|
|
|
|
lda #255
|
|
|
|
jsr WAIT
|
|
|
|
|
|
|
|
; restore X value
|
|
|
|
lda #34
|
|
|
|
sta HERO_X
|
|
|
|
|
|
|
|
rts
|