Ending the program
The final line of code will be to end the initialization of pygame, which we performed at the start of the code. To end this, we will type pygame.quit()
at the outermost level of indentation in our code. This goes outside of the while
loop so that it only happens when the while
loop stops running:
pygame.quit()
Once you have typed this, your final game code lines should look like this:
Once you have double-checked your code against the screenshots in the chapter, make sure that you save your tiny.py
file. Now you are ready to truly give your game a test!