-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenemyShotColDetectBoss.asm
More file actions
265 lines (257 loc) · 10.7 KB
/
enemyShotColDetectBoss.asm
File metadata and controls
265 lines (257 loc) · 10.7 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
; macros only: bank 3
BOSS1_HIT_X_OFFSET = 60
BOSS1_Y_LOW = 20
COL_DETECT_ENEMY_BOSS1 macro tShot
; colision detection player shot -> enemy
; only two shots are tested per game round
; two shots
; main must ensure the two to be tested shots are "halfway"
; in b is still the xcoordinate of the current enemy that is tested for thisshot
; is there a col detection at all if ALL purpose is negative? -> NO
; all behaviours with negative all purpose do not call col detect
; ergo ALL purpuse negtaive serves no purpose anymore!
ldx tShot
beq notHit\?
lda playerNumberOfBulletsPerShot
cmpa #6 ; laser
beq xCheckOnly_laser\?
; "non" shots have ypos set to max ($7f) therefore below test is always met and goes to noHit
; we do not need to test the shot itself for validity!
; yTest
; for "easyness" - just we say here if
; y pos of shot is >= enemyPos than we hit!
lda #BOSS1_Y_LOW
sta enemyMINY
cmpa tShot +T_YPOS
bge notHit\?
;;;;; y done
xCheckOnly\?
; xTest
ldb bossPosX
addb #$80 ; x coordinate enemy now 0 based in b 0-255
; test center
stb tmp1
addb #BOSS1_HIT_X_OFFSET
bcc testOnB3_1\?
ldb #$ff
testOnB3_1\?
cmpb tShot+T_XPOS0_MINUS_1_RADIUS
blo notHit\? ; enemy is on left side of shot
; in b 0 based enemy pos
subb #2*BOSS1_HIT_X_OFFSET
bcc testOnB3_2\?
ldb #$00
testOnB3_2\?
cmpb tShot+T_XPOS0_PLUS_1_RADIUS
bhi notHit\? ; enemy is on right side of shot
;..........
; if only scoop shots are left - we can not hit with "own" cannon
ldd #notHit\?
std backJump
inc tmp2_tmp_unique
jmp removeCurrentShotAndObjectBoss
xCheckOnly_laser\?
lda #BOSS1_Y_LOW ; pos of boss2, boss start at the top
; suba #$20; reduce by some offset to get the "mouth" part
; for laser cut off
sta laserTmp
clr laserTmp2 ; main laser only
bra xCheckOnly\?
;..........
notHit\?
endm
BOSS2_HIT_X_OFFSET = 7
BOSS2_Y_LOW = 20
COL_DETECT_ENEMY_BOSS2 macro tShot
;
ldx tShot
beq notHit\?
lda playerNumberOfBulletsPerShot
cmpa #6 ; laser
beq xCheckOnly_laser\?
; "non" shots have ypos set to max ($7f) therefore below test is always met and goes to noHit
; we do not need to test the shot itself for validity!
; yTest
; for "easyness" - just we say here if
; y pos of shot is >= enemyPos than we hit!
lda bossPosY ; pos of boss2, boss start at the top
suba #$48 ; reduce by some offset to get the "mouth" part
sta enemyMINY
cmpa tShot +T_YPOS
bge notHit\?
;;;;; y done
xCheckOnly\?
; xTest
ldb bossPosX
addb #$80 ; x coordinate enemy now 0 based in b 0-255
; test center
stb tmp1
addb #BOSS2_HIT_X_OFFSET
cmpb tShot+T_XPOS0_MINUS_1_RADIUS
blo notHit\? ; enemy is on left side of shot
; in b 0 based enemy pos
subb #2*BOSS2_HIT_X_OFFSET
cmpb tShot+T_XPOS0_PLUS_1_RADIUS
bhi notHit\? ; enemy is on right side of shot
;..........
; no scoopy with boss Swarm!
_scoopCenterHit\?
; if only scoop shots are left - we can not hit with "own" cannon
ldd #notHit\?
std backJump
inc tmp2_tmp_unique
jmp removeCurrentShotAndObjectBoss
xCheckOnly_laser\?
lda bossPosY ; pos of boss2, boss start at the top
suba #$48 ; reduce by some offset to get the "mouth" part
; for laser cut off
sta laserTmp
clr laserTmp2 ; main laser only
bra xCheckOnly\?
;..........
notHit\?
endm
; todo
; EXACTLY SAME AS BOSS 4
BOSS3_HIT_X_OFFSET = 30
COL_DETECT_ENEMY_BOSS3 macro tShot
;
ldx tShot
beq notHit\?
lda playerNumberOfBulletsPerShot
cmpa #6 ; laser
beq xCheckOnly_laser\?
; "non" shots have ypos set to max ($7f) therefore below test is always met and goes to noHit
; we do not need to test the shot itself for validity!
; yTest
; for "easyness" - just we say here if
; y pos of shot is >= enemyPos than we hit!
;
lda bossPosY ; pos of boss2, boss start at the top
suba #$28
sta enemyMINY
ldb bossPosY ; pos of boss2, boss start at the top
sex
; subd #$28; reduce by some offset to get the "mouth" part
std tmp3_tmp
ldb tShot +T_YPOS
sex
subd tmp3_tmp
bpl nonNegb2\?
std tmp3_tmp
clra
clrb
subd tmp3_tmp
nonNegb2\?
cmpd #$28
bhi notHit\?
;;;;; y done
xCheckOnly\?
; xTest
ldb bossPosX
addb #$80 ; x coordinate enemy now 0 based in b 0-255
; test center
stb tmp1
addb #BOSS3_HIT_X_OFFSET
bcc testOnB3_1\?
ldb #$ff
testOnB3_1\?
cmpb tShot+T_XPOS0_MINUS_1_RADIUS
blo notHit\? ; enemy is on left side of shot
; in b 0 based enemy pos
subb #2*BOSS3_HIT_X_OFFSET
bcc testOnB3_2\?
ldb #$00
testOnB3_2\?
cmpb tShot+T_XPOS0_PLUS_1_RADIUS
bhi notHit\? ; enemy is on right side of shot
;..........
; no scoopy with boss Swarm!
_scoopCenterHit\?
; if only scoop shots are left - we can not hit with "own" cannon
ldd #notHit\?
std backJump
inc tmp2_tmp_unique
jmp removeCurrentShotAndObjectBoss
xCheckOnly_laser\?
lda bossPosY ; pos of boss2, boss start at the top
suba #$20 ; reduce by some offset to get the "mouth" part
; for laser cut off
sta laserTmp
clr laserTmp2 ; main laser only
bra xCheckOnly\?
;..........
notHit\?
endm
; todo
BOSS4_HIT_X_OFFSET = 30
COL_DETECT_ENEMY_BOSS4 macro tShot
;
ldx tShot
beq notHit\?
lda playerNumberOfBulletsPerShot
cmpa #6 ; laser
beq xCheckOnly_laser\?
; "non" shots have ypos set to max ($7f) therefore below test is always met and goes to noHit
; we do not need to test the shot itself for validity!
; yTest
; for "easyness" - just we say here if
; y pos of shot is >= enemyPos than we hit!
;
lda bossPosY ; pos of boss2, boss start at the top
suba #$28
sta enemyMINY
;
ldb bossPosY ; pos of boss2, boss start at the top
sex
; subd #$28; reduce by some offset to get the "mouth" part
std tmp3_tmp
ldb tShot +T_YPOS
sex
subd tmp3_tmp
bpl nonNegb2\?
std tmp3_tmp
clra
clrb
subd tmp3_tmp
nonNegb2\?
cmpd #$28
bhi notHit\?
;;;;; y done
xCheckOnly\?
; xTest
ldb bossPosX
addb #$80 ; x coordinate enemy now 0 based in b 0-255
; test center
stb tmp1
addb #BOSS4_HIT_X_OFFSET
bcc testOnB3_1\?
ldb #$ff
testOnB3_1\?
cmpb tShot+T_XPOS0_MINUS_1_RADIUS
blo notHit\? ; enemy is on left side of shot
; in b 0 based enemy pos
subb #2*BOSS4_HIT_X_OFFSET
bcc testOnB3_2\?
ldb #$00
testOnB3_2\?
cmpb tShot+T_XPOS0_PLUS_1_RADIUS
bhi notHit\? ; enemy is on right side of shot
;..........
; no scoopy with boss Swarm!
_scoopCenterHit\?
; if only scoop shots are left - we can not hit with "own" cannon
ldd #notHit\?
std backJump
inc tmp2_tmp_unique
jmp removeCurrentShotAndObjectBoss
xCheckOnly_laser\?
lda bossPosY ; pos of boss2, boss start at the top
suba #$20 ; reduce by some offset to get the "mouth" part
; for laser cut off
sta laserTmp
clr laserTmp2 ; main laser only
bra xCheckOnly\?
;..........
notHit\?
endm