-
Notifications
You must be signed in to change notification settings - Fork 0
/
enemy_ant.asm
113 lines (107 loc) · 2.22 KB
/
enemy_ant.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
ant_spawn: subroutine
; x is set by enemy spawner
lda #$fc
sta enemy_ram_x,x ; x pos
lda #$00
sta enemy_ram_ac,x ; animation counter
txa
lsr
lsr
lsr
and #1
beq .dash_ant
.ceiling_ant
sta enemy_ram_ex,x
lda #$03
sta enemy_ram_y,x ; y ant pos
lda #$0c
sta enemy_ram_pc,x ; y dart origin
rts
.dash_ant
sta enemy_ram_ex,x
lda #$ad
sta enemy_ram_y,x ; y ant pos
sta enemy_ram_pc,x ; y dart origin
rts
ant_cycle: subroutine
lda #$10
sta collision_0_w
lda #$10
sta collision_0_h
jsr enemy_handle_damage_and_death
lda wtf
lsr
lsr
and #$3f
cmp #$37
bcc .normal_walking
.stop_and_shoot
; frames default to spazzing
; frames f0-f8 butt up
; frame f8 shoot dart
; frames f9-ff butt down
lda wtf
cmp #$f9
bcs .butt_down
cmp #$f8
bcs .dart_fire
cmp #$f0
bcs .butt_up
.butt_shake
lsr
and #$01
asl
clc
adc #$e8
sta enemy_ram_ac,x
bne .dont_advance
.butt_up
lda #$ea
sta enemy_ram_ac,x
bne .dont_advance
.dart_fire
lda enemy_ram_x,x
sta dart_x_origin
lda enemy_ram_pc,x
sta dart_y_origin
lda #$03
sta dart_velocity
lda #$00
sta dart_sprite
sta dart_dir_adjust
jsr dart_spawn
bne .dont_advance
.butt_down
lda #$e8
sta enemy_ram_ac,x
bne .dont_advance
.normal_walking
and #$03
asl
clc
adc #$e0
sta enemy_ram_ac,x
lda wtf
and #$03
bne .dont_advance
inc enemy_ram_x,x
.dont_advance
lda enemy_ram_x,x
jsr sprite_4_set_x
lda enemy_ram_y,x
jsr sprite_4_set_y
lda enemy_ram_ex,x
bne .ceiling_ant
.dash_ant
lda enemy_ram_ac,x
jsr sprite_4_set_sprite
lda #$01
bne .ant_pos_done
.ceiling_ant
lda enemy_ram_ac,x
jsr sprite_4_set_sprite_flip
lda #$81
.ant_pos_done
jsr sprite_4_set_palette
.done
jmp update_enemies_handler_next