![]() |
Routines |
Prev: 26038 | Up: Map | Next: 26097 |
Check whether the bullet's Y axis position matches an alien's location. If not, there's no collision. If so, go and check the bullet's X axis.
Used by the routine at is_alien_hit.
|
||||
bullet_alien_coll_yaxis | 26049 | LD A,(_PLAYER_BULLET_YPOS) | Pick up bullet Y pos | |
26052 | SRL A | Divide by 8 to convert bullet pixel ypos to cpos | ||
26054 | SRL A | |||
26056 | SRL A | |||
26058 | INC A | |||
26059 | LD (_COLL_YAXIS_TEMP_STORE),A | Save player bullet cy | ||
26062 | LD A,(_LOWEST_ACTIVE_ALIEN_ROW) | Number of rows aliens can fire from | ||
bullet_alien_coll_yaxis_0 | 26065 | LD (_HIT_ALIEN_ROW),A | _HIT_ALIEN_ROW is the loop counter | |
26068 | CALL find_alien_row_data | Address of alien row 'A's data | ||
26071 | LD A,(_COLL_YAXIS_TEMP_STORE) | Retrieve player bullet cy | ||
26074 | CP (IX+1) | Alien row left side cy | ||
26077 | JR Z,bullet_cy_hit_check_cx | Bullet and alien in same cy, could be a hit | ||
26079 | LD A,(_HIT_ALIEN_ROW) | Round to check next alien row | ||
26082 | DEC A | |||
26083 | JP P,bullet_alien_coll_yaxis_0 | |||
26086 | RET | No collision on the Y axis | ||
Jump here if there's a collision on the Y axis, go and check the X axis
|
||||
bullet_cy_hit_check_cx | 26087 | LD A,(_PLAYER_BULLET_XPOS) | Pick up bullet X pos | |
26090 | CALL bullet_alien_coll_xaxis | Do X axis collision check | ||
26093 | RET Z | Return if no collision | ||
26094 | JP alien_hit | Collision detected, kill the alien |
Prev: 26038 | Up: Map | Next: 26097 |