简体   繁体   English

Python:如何在pygame上制作标题屏幕?

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

How would you put in a title screen/ending screen in pygame? 您将如何在pygame中放置标题屏幕/结尾屏幕? Using the Enter key to continue and the Esc key to quit. 使用Enter键继续,并使用Esc键退出。

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. 我有一个标题屏幕,我个人是用photoshop制作的,我只想将其插入游戏的开头,然后让用户按Enter或Esc键即可。 How would I do that? 我该怎么做?

There are many Pygame resources out there on the web. 网络上有很多Pygame资源。 A recent book released by Al Sweigart, Making Games with Python and Pygame has some examples of what you are describing. Al Sweigart最近发行的《用Python和Pygame制作游戏》一书中有一些您所描述的示例。

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. 它具有一些可以完成您想要做的功能,即showStartScreen(),checkForKeyPress()和drawPressKeyMsg()函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM