Python 和 PyGame 的一些示例
看到一个网页收集了很多使用Python和PyGame写游戏的示例,分享给大家。(注:我不知道用Python/PyGame写游戏其性能会怎么样,但是一些小游戏应该是没有问题的)
这个网页同时给了一本介绍Python和PyGame的电子书(PDF),下面的这些例子就是这本书的示例。所有的这些示例可以打包下载。
目录
基础 Python 示例Pygame 图形示例Pygame 示例游戏示例创建一个安装包搜索和排序示例文件示例其它信息
基础 Python 示例
if_statement_examples.py – if 语句的一个简单示例
for_loop_examples.py – for 语句的一个简单示例.
while_loop_examples.py – while 语句的一个简单示例
Pygame 图形示例
pygame_base_template.py – 开启一个黑的 pygame 窗口。当你要写一个新的代码时,你可以使用这个示例的代码初始化你的程序。
simple_graphics_demo.py – 作图,画一些简单的图形。
functions_and_graphics.py – 图一些雪人。
animating_snow.py – 下雪动画。
move_keyboard.py – 使用键盘移动一个图形
move_mouse.py – 使用鼠标移动一个图形
move_game_controller.py – 使用游戏手柄移动一个图形
bitmapped_graphics.py – 显示一些图片(png, jpb),并加入一些声音。
array_backed_grid.py – 一个网格,可以用来开发一些棋类的游戏。
Pygame 示例
sprite_collect_blocks.py – 使用鼠标移动一个小点


move_sprite_keyboard_jump.py – 用键盘移动一个点(跳动式的)
move_sprite_keyboard_smooth.py – 用键盘移动一个点(平滑式的).
move_sprite_game_controller.py – 用游戏手柄移动一个点
move_with_walls_example.py – 移动一个点,但是会被墙阻止。
游戏示例
bounce_ball_with_paddle.py – 两个玩家玩对碰球游戏,需要两个手柄。


Download games – .
创建一个安装包
Python Pygame 安装包教程
搜索和排序示例
example_sorted_names.txt – Sample file of names used in searching_example.py searching_example.py – Example linear and binary searches AliceInWonderLand.txt – Text of Alice In Wonderland. Source: Project Gutenberg AliceInWonderLand200.txt dictionary.txt sorting_examples.py – Example code for the insertion and selection sorts.文件示例
high_score.py – Example that shows how to read and write a high score to the disk so that it persists between program runs.
其它信息
Pygame Website – Pygame 主站 Pygame Documentation – Pygame 文档——————————
最后,不好意思很久没有更新酷壳,这段时间在国外出差,事多,5月31回国。大家见谅!
转载于酷壳CoolShell 无删改 仅以此纪念陈皓(左耳朵耗子)
也就是说,只要具备这几个频段,在绝大部分国家和地区(大中华区、日韩、北美、东南亚、欧洲、英国、南美)都能保证基本的网络信号? 此外,鉴于华为很难在境外使用存在客观阻碍,小米阉割…
你们在管理服务器上的系统时是不是也会定期执行 apt upgrade 或者 yum update 之类的命令保证服务器系统上的软件源和包都是最新的 避免系统和软件的漏洞影响服务…
试了好多浅色的主题,VSCode Light 、Github Light 、Solarized Light ,Senlenlized Light 之类的。代码看着倒还好,ter…