Skip to content

Learning Python Day: 55

The _update_screen() Method

  • simplify run_game() even further by moving the code for updating the screen to a separate method called _update_screen():
  • moved the code that draws the background and the ship and flips the screen to _update_screen()
  • now the body of the main loop in run_game() is much simpler
  • easier to see new events, update the screen, tick the clock on each pass through the loop
  • when building out a project, you won’t know how to structure your code at first
  • this is a realistic development process: start writing code as simply as possible, and refactor it as your project grows more complex
  • next, we’ll work on dynamic aspects of the game
Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *