MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / gameover

Function gameover

projects/car game/Game.py:210–231  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

208 ###### creating our game over function #######
209
210 def gameover():
211 gameoverImg = pygame.image.load("gameover.png")
212 run = True
213 while run:
214 screen.blit(gameoverImg, (0, 0))
215 time.sleep(0.5)
216 show_score(330, 400)
217 time.sleep(0.5)
218 show_highscore(330, 450)
219 pygame.display.update()
220
221 for event in pygame.event.get():
222 if event.type == pygame.QUIT:
223 run = False
224 pygame.quit()
225 sys.exit()
226 if event.type == pygame.KEYDOWN:
227 if event.key == pygame.K_SPACE:
228 countdown()
229 if event.key == pygame.K_ESCAPE:
230 pygame.quit()
231 sys.exit()
232
233 # setting background image
234 bg = pygame.image.load("bg.png")

Callers 1

gameloopFunction · 0.85

Calls 4

show_highscoreFunction · 0.85
show_scoreFunction · 0.70
countdownFunction · 0.70
updateMethod · 0.45

Tested by

no test coverage detected