Prev: 6090 Up: Map Next: 60FD
60AA: Player Turn Ends
Used by the routine at AnimateExplosion.
Runs when Robbie has been killed. If the flower has also been eaten away then the "YOUR PLANT HAS BEEN EATEN" message is shown first and the flower is reset. All of the bugs are removed, and then either the current player starts another turn, the other player takes over, or the game is over.
Before After (flower eaten)
turn-ends-before turn-ends-after
PlayerTurnEnds 60AA XOR A Write 00 to State_BonusItem.
60AB LD ($5E3C),A
Check whether the flower has been eaten right down to the ground.
60AE LD HL,$5E8E Point HL at the flower's Y position (State_Flower_Pos_Y).
60B1 LD A,(HL) A=the flower Y position.
60B2 CP $B7 Jump to PlayerTurnEnds_RemoveBugs if the flower Y position is less than B7.
60B4 JR C,PlayerTurnEnds_RemoveBugs
60B6 LD (HL),$A7 Reset the flower Y position to A7.
60B8 CALL CreateWindow Create the game window using CreateWindow.
60BB LD DE,$6090 DE=the "YOUR PLANT HAS BEEN EATEN" message (Message_Eaten).
60BE LD HL,$7020 HL=7020 (screen position).
60C1 CALL GameOverPrint_Pause Print the message and pause using GameOverPrint_Pause.
Remove all of the bugs and the explosion object.
PlayerTurnEnds_RemoveBugs 60C4 LD HL,$5EB4 HL=State_Bugs (the first bug).
60C7 LD B,$07 Set the object counter to 07 (the bugs and the explosion).
60C9 CALL SetObjectInactive Set the objects inactive using SetObjectInactive.
Is this a 2UP game?
60CC LD A,($5E03) A=the game options from GameOptions.
60CF AND %00000001 Keep only bit 0 (the player count).
60D1 JR NZ,PlayerTurnEnds_2UP Jump to PlayerTurnEnds_2UP if this is a 2UP game.
Handle 1UP player.
PlayerTurnEnds_1UP 60D3 LD A,($5E38) Jump to GameOver_ControllerRestart if the current player is out of lives (using CurrentPlayer_Lives).
60D6 AND A
60D7 JP Z,GameOver_ControllerRestart
60DA CALL LevelInit Create the game window using LevelInit.
60DD JP PlayerInit Jump to PlayerInit to start the player's next turn.
Handle 2UP player.
PlayerTurnEnds_2UP 60E0 LD A,($5E3A) Jump to PlayerTurnEnds_1UP if the other player is out of lives (using InactivePlayer_Lives).
60E3 AND A
60E4 JR Z,PlayerTurnEnds_1UP
60E6 LD A,($5E38) Call GameOver_Controller if the current player is out of lives (using CurrentPlayer_Lives).
60E9 AND A
60EA CALL Z,GameOver_Controller
60ED CALL ChangePlayer Swap the two players' data using ChangePlayer.
60F0 LD A,($5E1E) Change current player at Current_Player (flip bits between 00 and FF).
60F3 CPL
60F4 LD ($5E1E),A
60F7 CALL LevelInit Create the game window using LevelInit.
60FA JP PlayerInit Jump to PlayerInit to start the other player's turn.
Prev: 6090 Up: Map Next: 60FD