Prev: 25368 Up: Map Next: 25478
25427: 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 25427 CALL RemoveEntity Call RemoveEntity to erase the explosion.
25430 CALL SetNightAttributes Switch to night time using SetNightAttributes.
Give a 50/50 chance of "Night Driver" mode.
25433 LD A,R Fetch a random number (from the Z80 refresh register).
25435 AND %00000001 Keep only bit 0.
25437 JR Z,GameOver_Skip If the random bit is clear then jump to GameOver_Skip, keeping night time.
Else set "day" time.
25439 CALL SetDayAttributes Switch back to day time using SetDayAttributes.
GameOver_Skip 25442 LD HL,24125 Point HL at the number of lives (Player_Lives).
25445 DEC (HL) Take a life away.
25446 JP P,PlayerInit If the number of lives is not negative then jump to PlayerInit.
Else, trigger the game over events.
25449 LD (HL),0 Set the number of lives to 0.
25451 POP HL Remove the return address (NextEntity) pushed by the main loop from the stack.
25452 CALL CheckHighScore Check for a new high score using CheckHighScore.
25455 CALL SetDayAttributes Switch to day time using SetDayAttributes.
25458 CALL CreateWindow Create the game window using CreateWindow.
Print the "Game Over" messaging.
25461 LD HL,22648 HL=22648 (pixel co-ordinates: H is the Y position and L is the X position).
25464 LD DE,25562 Point DE at the "GAME OVER" text (Message_GameOver).
25467 CALL MenuWriteText Print the text using MenuWriteText.
Display the text for a short time.
25470 LD B,4 Set the delay count to 4.
25472 CALL Delay Wait using Delay.
25475 JP Game_Restart Jump to Game_Restart to go back to the game selection menu.
View the equivalent code in;
Prev: 25368 Up: Map Next: 25478