資源簡介
貪吃蛇,游戲開發學習
代碼片段和文件信息
#?-*-?coding:?cp936?-*-
“““python2.7?/?Windows控制臺“““
import?ostimerandommsvcrt
helpInfo=u“““A?S?D?W?操控
Num?1-4?游戲速度
Space???暫停
R???????重玩
Q???????變換花色
G???????屏幕大小
Esc?????退出“““
gridWidthgridHeight=1020?#柵格寬高
rewardDict={1:12:33:64:10}?#炸樓/得分表
gears={1:.642:.323:.164:.08}?#速度/刷新時間間隔
gameSpeed=1
patterns=u“■◇●¤◆※▓卐╬囧“?#填充花色
def?pTurntable():
while?True:
for?c?in?patterns:
yield?c
nPattern=pTurntable()
cellPattern=next(nPattern)
class?Tetris():
mino_I=((00)(10)(20)(30))??((1-1)(10)(11)(12))
mino_J=((00)(01)(11)(21))??((0-1)(00)(01)(1-1))??((00)(21)(10)(20))??((01)(1-1)(10)(11))
mino_L=((00)(01)(10)(20))??((0-1)(10)(11)(1-1))??((01)(20)(11)(21))??((0-1)(00
評論
共有 條評論