![]() |
Routines |
Prev: 24664 | Up: Map | Next: 24794 |
|
||||
start | 24703 | DI | Start here | |
24704 | CALL reset_game_data | Game data initialisation, copies 10 bytes | ||
24707 | CALL clear_pixels | Clear screen pixels | ||
24710 | CALL reset_score_update_high | Reset score, maybe update high score from last High score is only updated when new game starts which seems a tad unfair | ||
24713 | CALL draw_lives_remaining | Draw lives as ships on top row | ||
Top of new screen loop. This entry point is used by the routine at advance_alien_start_row which advances the aliens one row when a screen has been cleared. It then jumps back to here to start the next screen.
|
||||
new_screen_loop | 24716 | CALL init_new_screen | Call a sequence of subroutines to initialise the game's data structures | |
24719 | CALL set_alien_speed | |||
24722 | CALL init_alien_row_data | |||
24725 | CALL init_attributes | |||
24728 | CALL new_player_ship | Draw the components of the game then enter the main loop | ||
24731 | CALL draw_barriers | |||
24734 | CALL init_draw_aliens | |||
Game loop, read keyboard, move player, move bullets, zap aliens, etc., until player is hit.
|
||||
game_loop | 24737 | CALL check_for_extra_life | Consider awarding extra life | |
24740 | CALL update_onscreen_score | Update score shown onscreen | ||
24743 | CALL handle_inputs | Read keyboard, deal with ship and bullet repositioning | ||
24746 | CALL is_alien_hit | Check if bullet has hit alien, kill alien if so | ||
24749 | LD A,(_NUM_ALIENS_REMAINING) | If there are no aliens left advance their starting position on the next screen which is about to appear. The routine jumps back to new_screen_loop | ||
24752 | OR A | |||
24753 | JP Z,advance_alien_start_row | |||
24756 | CALL move_alien_bullets | Advance alien bullets down the screen | ||
24759 | JR Z,start_0 | No collision, jump over the "player hit" handling code | ||
24761 | LD A,(_LIVES_REMAINING) | Player has been hit. If lives remaining is zero jump straight to the game over code. Otherwise redraw the lives left at top then carry on | ||
24764 | OR A | |||
24765 | JP Z,game_over | |||
24768 | CALL draw_lives_remaining | |||
start_0 | 24771 | CALL spaceship_handler | Spaceship code, create one, move one, check whether it's been hit | |
24774 | CALL dec_timer_move_aliens | Move a row of aliens along the screen | ||
24777 | LD A,(_LIVES_REMAINING) | Check lives over again, since stuff has happened and it's possible the player has been hit in the meantime | ||
24780 | OR A | |||
24781 | JP Z,game_over | |||
24784 | LD A,(_ALIENS_LANDED) | Have the aliens landed? Game over if they have. | ||
24787 | OR A | |||
24788 | JP NZ,game_over | |||
Slight delay to keep speed consistent, then this jumps back to top of game loop
|
||||
24791 | JP dynamic_pause |
Prev: 24664 | Up: Map | Next: 24794 |