Python:您如何在pygame上制作标题屏幕? [英] Python: How do you make a title screen on pygame?

查看:312
本文介绍了Python:您如何在pygame上制作标题屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何在pygame中放置标题屏幕/结尾屏幕?使用Enter键继续,然后按Esc键退出.

How would you put in a title screen/ending screen in pygame? Using the Enter key to continue and the Esc key to quit.

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

推荐答案

网络上有很多Pygame资源. Al Sweigart最近发行的一本书使用Python和Pygame制作游戏提供了一些有关您的例子描述.

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.

特别是,请看以下示例程序.它具有一些可以完成您想要做的功能,即showStartScreen(),checkForKeyPress()和drawPressKeyMsg()函数.

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.

这篇关于Python:您如何在pygame上制作标题屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆