资源简介
Pygame游戏源代码:俄罗斯方块
包含代码、图片、声音等所有资源,可直接运行

代码片段和文件信息
#!/usr/bin/env python
import pygame
from pygame.locals import *
from pygame.time import *
from sys import exit
from random import *
from shapebase import *
from shapes import *
“““init game“““
pygame.init()
screen = pygame.display.set_mode((800600)032)
pygame.display.set_caption(“Rusia Block“)
icon = pygame.image.load(“py.jpg“)
pygame.display.set_icon(icon)
screen.fill((160160160))
“““some value use in main loop“““
shapeslist = [[[0 for a in range(4)] for b in range(20)] for c in range(16)]##all droped block
cur_pos = [[0 for a in range(2)] for b in range(4)]#current droping block‘position4 block [xy]
rgb = [0 for a in range(3)]#current droping block‘s rgb
bottom = True
right_pos = ((0 for a in range(2)) for b in range(4))#current droping block‘rightshow position
j = 0
total_score = 0
“““the public functions“““
def newShape(cur_pos):
“““create a new random shape“““
i = randint(06)
j = randint(03)
rgb = [randint(0255)randint(0255)randint(0255)]
if i == 0:#l2
if j == 0:
cur_pos = [[719][718][717][617]]
elif j == 1:
cur_pos = [[619][719][819][818]]
elif j == 2:
cur_pos = [[719][819][718][717]]
elif j == 3:
cur_pos = [[719][718][818][918]]
ashape = shapeL2(cur_posshapeslistrgb)
if i == 1:#t
if j == 0:
cur_pos = [[719][619][718][819]]
elif j == 1:
cur_pos = [[719][718][717][818]]
elif j == 2:
cur_pos = [[719][718][618][818]]
elif j == 3:
cur_pos = [[719][718][717][618]]
ashape = shapeT(cur_posshapeslistrgb)
if i == 2:#z
if j % 2 == 0:
cur_pos = [[719][718][619][818]]
elif j % 2 == 1:
cur_pos = [[719][718][618][617]]
ashape = shapeZ(cur_posshapeslistrgb)
if i == 3:#l
if j == 0:
cur_pos = [[719][718][717][817]]
elif j == 1:
cur_pos = [[719][718][618][518]]
elif j == 2:
cur_pos = [[719][619][718][717]]
elif j == 3:
cur_pos = [[719][718][819][919]]
ashape = shapeL(cur_posshapeslistrgb)
if i == 4:#z2
if j % 2 == 0:
cur_pos = [[719][718][618][819]]
elif j % 2 == 1:
cur_pos = [[719][718][818][817]]
ashape = shapeZ2(cur_posshapeslistrgb)
if i == 5:#o
cur_pos = [[719][718][819][818]]
ashape = shapeO(cur_posshapeslistrgb)
if i == 6:#i
if j % 2 == 0:
cur_pos = [[719][718][717][716]]
elif j % 2 == 1:
cur_pos = [[719][619][819][919]]
ashape = shapeI(cur_posshapeslistrgb)
return ashape j
def showChanged(screenrgbcur_pos):
“““flesh screen while k
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7976 2008-09-10 20:20 main.py
文件 14289 2008-09-06 11:15 py.jpg
文件 2929 2008-09-10 20:20 shapeba
文件 3522 2012-07-25 14:53 shapeba
文件 10139 2008-09-10 12:31 shapes.py
文件 16376 2012-07-25 14:53 shapes.pyc
----------- --------- ---------- ----- ----
55231 6
- 上一篇:图书管理系统活动图
- 下一篇:永磁同步电机矢量控制双滑模模型参考 自适应系统转速辨识
相关资源
- linux应用层的华容道游戏源代码
- 拼图游戏源代码 powerbuilder 9.0实例
- 用PB编写俄罗斯方块
- PB做的俄罗斯方块
- 3D版俄罗斯方块
- 全屏的俄罗斯方块源程序
- js canvas写的游戏 俄罗斯方块
- 祖玛游戏源代码快下吧快快
- ios-swift 版 俄罗斯方块.zip
- pygame猴子接水果小游戏
- 基于STM32的使用12864做的俄罗斯方块
- 基于OpenGL实现俄罗斯方块
- 俄罗斯方块 SDL 版
- 基于CortexM4的俄罗斯方块游戏代码加文
- 基于STM32的俄罗斯方块
- Cocos2dx游戏源代码《萝莉快跑》
- flash祖玛游戏源代码244940
- pygame实现的弹珠游戏源码
- cocos2dx 3.3 跑酷游戏源代码和资源
- win ce 5.0下推箱子游戏源代码
- 3D OPENGL 飞行游戏源代码
- 6种俄罗斯方块游戏h5
- flash打地鼠游戏源代码
- Pygame游戏源代码:超级玛丽
- windowsAPI 俄罗斯方块超详细完美教程
- 抢车位游戏源代码
- 趣味桌球小游戏源代码
- 游戏源代码RPG 游戏
- 各种游戏源代码
- Pygame游戏源代码:超级玛丽.rar
评论
共有 条评论