Skip to main content

一个零样板的 2D 游戏框架

项目描述

基于 Pygame 的 Python 3 零样板游戏编程框架。

一些例子

Pygame Zero 由一个运行程序 pgzrun组成,它将运行一个带有完整游戏循环和一系列有用的内置函数的 Pygame Zero 脚本。

这是您可以做的一些巧妙的事情。请注意,这些都是一个独立的脚本。文件中不需要任何导入或任何其他内容。

绘制图形(假设有images/dog.pngimages/dog.jpg之类的文件):

def draw():
    screen.clear()
    screen.blit('dog', (10, 50))

单击鼠标时播放声音sounds/eep.wav :

def on_mouse_down():
    sounds.eep.play()

绘制一个在屏幕上移动的“演员”对象(带有 sprite images/alien.png):

alien = Actor('alien')
alien.pos = 10, 10

def draw():
    screen.clear()
    alien.draw()

def update():
    alien.x += 1
    if alien.left > WIDTH:
        alien.right = 0

安装

请参阅安装说明

文档

完整的文档位于http://pygame-zero.readthedocs.org/

阅读http://pygame-zero.readthedocs.org/en/latest/introduction.html 上的教程,了解 Pygame Zero 可以做的其他事情。

贡献

该项目托管在 Github 上:

https://github.com/lordmauve/pgzero

如果你想帮助 Pygame Zero 的开发,你可以在文档中找到一些关于设置开发版本的说明:

http://pygame-zero.readthedocs.org/en/latest/contributing.html

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

pgzero_yt-1.5.16.tar.gz (75.6 kB 查看哈希

已上传 source