一个好的 python 库可以用来编写具有漂亮图形的 pacman 便携式版本?
我基本上想使用 Python 克隆经典游戏 Pacman。我想保留所有原始图形、声音等。也许能够让游戏处于窗口模式会很有用。
对于 Java,我只需要使用 Swing 就可以了。但我真的很想使用 Python,让游戏能够在所有主要平台上运行,而用户只需付出最少的努力。
我以前使用过 pygame,但觉得它有点“hacky”,而且使用起来不太直观。
I basically want to make a clone of the classic game Pacman using Python. I would like to keep all the original graphics, sounds, etc. Perhaps being able to have the game in windowed mode would be useful.
With Java I would just use Swing and be done with it. But I'd really like to use Python and make it possible for the game to work on all major platforms with minimal effort from the users.
I've used pygame previously but felt that it was a bit 'hacky' and not all that intuitive to use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试 PyQt4。 Qt 不仅适用于游戏,而且它还有一个 QGraphicsView 和 OpenGL 小部件,您可以在其中从 Python 进行渲染。
Try PyQt4. Qt isn't only meant for games but it has a QGraphicsView and an OpenGL widget where you can render from Python.
使用 Tkinter 可以像大多数其他工具包一样轻松(或更简单)地完成此操作。由于 pac-man 图形设置的标准相当低,您可以使用画布小部件来编写这一切。这可以说是最便携的解决方案,因为 Tkinter 是官方的捆绑 GUI 工具包,因此您不需要人们下载任何额外的库。
画布小部件为您提供了一个漂亮的基于矢量的绘图表面,具有良好的标记功能,可让您轻松移动绘制的对象。它支持所有基本的绘图基元——直线、圆等,并且能够嵌入位图图形甚至其他小部件。
You could do this with Tkinter about as easily (or easier) than most other toolkits. Since pac-man graphics set the bar pretty low you could code this all by using the canvas widget. This is arguably the most portable solution since Tkinter is the official, bundled GUI toolkit so you won't require people to download any extra libraries.
The canvas widget gives you a nice vector-based drawing surface, with nice tagging abilities that let you easily move drawn objects. It supports all the basic drawing primitives -- lines, circles, etc. as well as being able to embed bitmap graphics and even other widgets.
看看Panda3D!它组织得很好,所以很容易上手,而且功能强大,足以快速创建简单的游戏(如吃豆人)。它可在 Windows、Mac OSX 和 Linux 上使用。
Check out Panda3D! It's pretty well organized so very easy to pick-up and powerful enough to create simple games (like pacman) real quick. It's available on Windows, Mac OSX and Linux.