Prev: 25749 Up: Map Next: 25976
25853: Move alien bullet
Move an alien bullet down screen. Clear the sprite from its current location, and if it's gone off the bottom then return. Otherwise call the routine which checks and deals with bullets hitting a barrier. If it hasn't hit a barrier check whether it's hit the player. If it has, that's the next-player-life point.
Used by the routine at move_alien_bullets.
Input
IX Points to an alien bullet structure
move_alien_bullet 25853 LD HL,_GFX_ALIEN_BULLET Alien bullet graphic
25856 LD A,1 Mode clear
25858 CALL sprite_draw_or_clear Clear alien bullet
25861 LD A,(IX+1) Alien bullet ypos
25864 INC A Move down screen
25865 CP 185 Got to the bottom?
25867 JP NC,clear_alien_bullet_sprite_0 Bullet done with, jump out of here and reset the slot
25870 CP 177 Got to below the barriers?
25872 JP NC,has_alien_hit_player Skip barrier checks
Check whether the alien bullet has hit a barrier
This entry point is used by the routine at inc_alien_bullet_pos.
has_alien_hit_barrier 25875 LD (IX+1),A Update alien bullet ypos
25878 ADD A,5 Tip of bullet as it heads downwards
25880 LD B,A Leading tip of bullet screen location is in BC
25881 LD C,(IX+0)
25884 PUSH IX Call subroutine to check whether alien bullet has hit a barrier. Z flag set on return means it hasn't, NZ means it has
25886 CALL bullet_barrier_hit
25889 POP IX
25891 JP NZ,clear_alien_bullet_sprite_0 Z flag from that subroutine means bullet still in flight. Otherwise clear it.
25894 LD HL,_GFX_ALIEN_BULLET Bullet still in flight, above player and not hit a barrier. Draw bullet sprite, jumping out of this routine
25897 XOR A
25898 JP sprite_draw_or_clear
The alien bullet has got to the player ship level. Is the player ship hit?
has_alien_hit_player 25901 LD A,(IX+0) Pick up alien bullet xpos
25904 LD B,A Stash in B
25905 LD A,(_PLAYER_XPOS) Player ship pos, X
25908 CP B Left of player ship, no hit, so jump out to redraw bullet
25909 JR NC,inc_alien_bullet_pos
25911 ADD A,19 Right xpos side of player ship
25913 CP B Right of player ship, no hit, so jump out to redraw bullet
25914 JR C,inc_alien_bullet_pos
25916 XOR A Player hit. Set player ship xpos back to left side ready for restart with next life
25917 LD (_PLAYER_XPOS),A
Player has been hit, sound the siren
25920 LD B,8 8 iterations of the siren
player_hit_siren 25922 LD A,(_PORT254_SHADOW) Pick up port 254 shadow
25925 ADD A,8 Cycle border colour
25927 AND 56 Mask out bottom 3 bits
25929 LD (_PORT254_SHADOW),A Put it back
25932 CALL sound_burbler Sound burbler
25935 DEFB 40,10,40,20,40,40,40,80 Player hit noise
25943 DEFB 0
25944 DJNZ player_hit_siren Repeat player hit *8
Restart with next life
25946 CALL clear_bottom_char_row Clear bottom row
25949 CALL sound_burbler Sound burbler
25952 DEFB 50,255,255,50,50,255,0 About to restart sound
25959 LD A,(_LIVES_REMAINING) Decrement lives remaining
25962 DEC A This would be the infinite lives poke
25963 LD (_LIVES_REMAINING),A
25966 CALL NZ,new_player_ship Not zero, so next player ship
All alien bullets are cleared when a new life is started
25969 CALL clear_alien_bullets Clear all alien bullets
25972 OR 1 Reset Z flag
25974 POP HL
25975 RET
Prev: 25749 Up: Map Next: 25976