Prev: 6B8B Up: Map Next: 6BE0
6BAF: Handle End Of Life
The handler for Charlie's actor slot once he has fallen to the bottom of the screen (ID 18). Nothing happens until all of the other actors have gone. Then, if the game is for one player, or the other player has no lives left, the game goes on with StartLife if the active player has a life left, and is over (see GameOver_ControllerRestart) if not. In a two player game, when both players have lives left, the players swap. If the active player has just lost the last life then "GAME OVER PLAYER n" is shown for that player first.
Input
IX Actor
HandleEndOfLife 6BAF LD A,($5F1C) Fetch the number of actors which were in play on the last pass.
6BB2 AND A Were there any actors in play on the last pass?
6BB3 RET NZ Return if there were.
6BB4 LD A,($5F0C) Fetch the game options.
6BB7 AND A Are the game options zero (a 1UP game with the keyboard)?
6BB8 JR NZ,HandleEndOfLife_TwoPlayer Jump to HandleEndOfLife_TwoPlayer if the options are not zero.
HandleEndOfLife_OnePlayer 6BBA LD A,($5F2E) Fetch the lives of the active player.
6BBD AND A Has the active player run out of lives?
6BBE JR Z,GameOver_ControllerRestart Jump to GameOver_ControllerRestart if so.
6BC0 JP StartLife Jump to StartLife to start the next life.
HandleEndOfLife_TwoPlayer 6BC3 LD A,($5F32) Fetch the lives of the inactive player.
6BC6 AND A Has the other player run out of lives?
6BC7 JR Z,HandleEndOfLife_OnePlayer Jump to HandleEndOfLife_OnePlayer if so.
6BC9 LD A,($5F2E) Fetch the lives of the active player.
6BCC AND A Has the active player run out of lives?
6BCD CALL Z,GameOver_Controller Call GameOver_Controller if so, to show the "GAME OVER" message.
6BD0 CALL ChangePlayer Swap the data for the two players using ChangePlayer.
6BD3 LD A,($5F21) Fetch the active player (00 for 1UP, FF for 2UP).
6BD6 CPL Invert A, so the other player is active.
6BD7 LD ($5F21),A Update the active player (Flag_ActivePlayer).
6BDA CALL StartLevel_TestLevel Draw the window, the pantry and the lives using StartLevel_TestLevel.
6BDD JP StartLife Jump to StartLife to start the next life.
Prev: 6B8B Up: Map Next: 6BE0