Prev: 30857 Up: Map Next: 31075
30995: Move one row of aliens down
Aliens have got to one side of the screen, move them down row by row. This routine moves one row down and redraws that row. If they've got to the level of the barriers, remove the barriers. If they've got to the player's level then they've landed and the game will be flagged as over (actioned next game loop).
Used by the routine at move_aliens.
Input
#31109 Data of alien row to move down, starts cx,cy
move_one_row_aliens_down 30995 CALL sound_burbler Sound burbler, blip as row is moved down
30998 DEFB 8,250,0
Sound burbler return point
31001 LD A,(_LOWEST_ALIEN_YPOS) Lowest alien position
31004 CP 18 Row 18 is top of barriers, remove them if the aliens are that far
31006 CALL NC,remove_barriers
31009 LD A,(_LOWEST_ALIEN_YPOS) Lowest alien position again
31012 CP 21 Row 21 is bottom of screen. If they've got this low it's game over
31014 JR Z,aliens_landed
31016 LD B,A BC contains lowest alien ypos
31017 LD C,0
31019 CALL cxy2saddr cxy2saddr: DE = screen address of lowest alien
31022 CALL clear_char_row Clear one character row (32 chars) Alien sprites are 2 chars high, this clears the top of the alien's heads
31025 LD BC,(_NEXT_ALIEN_ROW_TO_DRAW) Increment the alien row ypos
31029 INC B
This entry point is used by the routine at position_and_print_moved_row.
print_moved_row 31030 LD IX,(_ALIEN_ROW_PTR) Pointer to alien structure
31034 LD (IX+0),C New ypos
31037 LD (IX+1),B New xpos
31040 CALL prep_alien_row_data Work out this row's left side space, the width of the horde, and the right side space. Prime all values ready for the print routine.
31043 JP print_alien_row Exit via the print row code
We get here if the aliens have got to the player's level - game over
aliens_landed 31046 LD A,1 Flag that the aliens have landed.
31048 LD (_ALIENS_LANDED),A
31051 CALL sound_burbler Sound burbler
31054 DEFB 250,100,250
31057 DEFB 200,250,250
31060 DEFB 250,250,0
31063 RET
This entry point is used by the routine at move_aliens.
position_and_print_moved_row 31064 LD BC,(_NEXT_ALIEN_ROW_TO_DRAW) Pick up row position, cx in C
31068 LD A,(_HORDE_DIRECTION) Pick up horde direction: 1 for rightwards, -1 for leftwards
31071 ADD A,C Add that to this row's left offset
31072 LD C,A Gives new x pos of row
31073 JR print_moved_row Jump to draw the row
Prev: 30857 Up: Map Next: 31075