Prev: 6318 Up: Map Next: 6386
6353: Game Over
Used by the routine at HandlerExplosion.
Reached when the explosion has finished. Takes a life away. If there are lives left then the next car starts at PlayerInit, otherwise the best time is checked, "GAME OVER" is shown for a short while and the game restarts.
Before After
game-over-before game-over-after
GameOver 6353 CALL RemoveEntity Call RemoveEntity to erase the explosion.
6356 CALL SetNightAttributes Switch to night time using SetNightAttributes.
Give a 50/50 chance of "Night Driver" mode.
6359 LD A,R Fetch a random number (from the Z80 refresh register).
635B AND %00000001 Keep only bit 0.
635D JR Z,GameOver_Skip If the random bit is clear then jump to GameOver_Skip, keeping night time.
Else set "day" time.
635F CALL SetDayAttributes Switch back to day time using SetDayAttributes.
GameOver_Skip 6362 LD HL,$5E3D Point HL at the number of lives (Player_Lives).
6365 DEC (HL) Take a life away.
6366 JP P,PlayerInit If the number of lives is not negative then jump to PlayerInit.
Else, trigger the game over events.
6369 LD (HL),$00 Set the number of lives to 00.
636B POP HL Remove the return address (NextEntity) pushed by the main loop from the stack.
636C CALL CheckHighScore Check for a new high score using CheckHighScore.
636F CALL SetDayAttributes Switch to day time using SetDayAttributes.
6372 CALL CreateWindow Create the game window using CreateWindow.
Print the "Game Over" messaging.
6375 LD HL,$5878 HL=5878 (pixel co-ordinates: H is the Y position and L is the X position).
6378 LD DE,$63DA Point DE at the "GAME OVER" text (Message_GameOver).
637B CALL MenuWriteText Print the text using MenuWriteText.
Display the text for a short time.
637E LD B,$04 Set the delay count to 04.
6380 CALL Delay Wait using Delay.
6383 JP Game_Restart Jump to Game_Restart to go back to the game selection menu.
View the equivalent code in;
Prev: 6318 Up: Map Next: 6386