有哪些小游戏可以直接用python编写?

有哪些小游戏可以直接用python编写?,第1张

ant 蚂蚁2 bagels 百吉饼另外贪吃蛇,吃豆子都是可以的,直接代码就可以玩。

Python包括随您的安装一起分发的大量标准库。标准库有一个称为Turtle的模块,这是一种向普通人介绍python编程的流行方法。今天介绍的所有游戏都是使用Python及其Turtle模块实现的。

每个游戏都完全独立于其他游戏,不试一试 您永远都不知道最喜欢哪种游戏。

安装完之后我们可以使用"python -m freegames list"来查看所有的游戏

贪吃蛇

贪吃蛇 -经典街机游戏。使用箭头键导航并吃绿色食品。每次食用食物,蛇就会长出一段。避免自己进食或出界!

豆子

吃豆子 –经典街机游戏。使用箭头键导航并吃掉所有白色食物。提防漫游迷宫的红色幽灵。

Flappy

Flappy-bird启发游戏。单击屏幕拍打翅膀。当您飞越屏幕时,请当心黑乌鸦。

加农炮

大炮-射击运动。单击屏幕发射您的炮d。炮d在其路径中d出蓝色气球。d出所有气球,然后才能越过屏幕。

直接用python的Tkinter模块写游戏不是很方便。 建议装pygame。
pygame主页projects分类下有大量游戏源码下载。
去pygame主页一看便知。引用一段pygame主页的FAQ:
Where can I find simple Pygame examples
The book Making Games with Python & Pygame has the source code for several simple games (Tetris, Bejeweled, Nibbles, etc) with detailed explanation
The Pygame documents folder in the download contains several examples These examples include the chimp program from the tutorials as well as two versions of aliens
The Pygame Cookbook has some drop in code for doing various tasks in Pygame
Another set of cookbook style example code is available from Simpson College here, this code also links to an on-line text that explains the answers and beginning coding concepts
The Pygame Projects pages contain programs with a wide range of
sophistication, starting with beginning programmers first attempt Have a look at the arcade and 2d tags There are many versions of pong and snake The source code for the book GAME PROGRAMMING by Andy Harris [ISBN-13: 978-0-470-06822-9] is here The first Pygame example is in chapter four, "Building a Game Example


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/13352415.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-20
下一篇 2023-07-20

发表评论

登录后才能评论

评论列表(0条)

保存