问题
How would you put in a title screen/ending screen in pygame? Using the Enter key to continue and the Esc key to quit.
I have a title screen that I personally made off of photoshop and I'd like to just insert it into the beginning of the game and just have the user either press Enter or Esc. How would I do that?
回答1:
There are many Pygame resources out there on the web. A recent book released by Al Sweigart, Making Games with Python and Pygame has some examples of what you are describing.
In particular, take a look at the following sample program. This has some functions that will accomplish what you want to do, namely the showStartScreen(), checkForKeyPress(), and drawPressKeyMsg() functions.
来源:https://stackoverflow.com/questions/10213558/python-how-do-you-make-a-title-screen-on-pygame