Python: How do you make a title screen on pygame?

岁酱吖の 提交于 2019-12-13 03:20:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!