text: Now that we've got movement, and boundaries, we need some way of informing our gamer that they 'dun goofed. Just simply exiting the game is rather harsh on our player. Instead, what we want to do is have some sort of "game over" screen. To do this, we need to show some text to the screen.
  Our new code is as follows:
  import pygame import time: crash() pygame.display.update() clock.tick(60) game_loop() pygame.quit() quit()
  So the major changes are some new functions, but they all boil down to this line from our main loop:
  if x > display_width - car_width or x < 0: crash()
  We want to be able to have some sort of handling specific to our users crashing rather than just lumping it in with an exit. So, we know we want to be able to do a crash, so we just need to make a crash function.
  So, then we consider what would be the most ideal situation for us to create a crash:
  def crash(): message_display('You Crashed')
  Since we might want to make a crash more elaborate in the future, we make a specific function, but, for now, we just want to utilize a message_display function. Too bad it doesn't exist! We can see how it might be useful though, so we're going to make one.()
  So there's our message displaying function, we define the large text, then we define the text and the rectangle that would encompass it. We then center the text, using our width and height variables (the gift that keeps on giving...just imagine deciding you wanted to change dimensions now?). Then we blit this stuff to the surface, remembering this only draws it in the background, and that we need to call "pygame.display.update()."
  Easy enough, after the message display, we run back to the game loop, whatever that happens to be. In hindsight, I think the superior choice for the game_loop() function call would actually be in our crash function, after calling message_display. It makes way more sense, since all messages you might want to display shouldn't lead to restarting the game. I advise doing that instead of the way shown in the code here and the video, I am only just now noticing this as I write this a while after writing and filming.
  Finally, we realize that, gosh darnit, text_objects doesn't exist yet! Let's finally make that one!
  def text_objects(text, font): textSurface = font.render(text, True, black) return textSurface, textSurface.get_rect()
  The only fancy thing we're doing here is using .get_rect() to get the rectangle that is somewhat invisible, so we can reference it and center the text.