资源简介
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
- 上一篇:图书管理系统活动图
- 下一篇:永磁同步电机矢量控制双滑模模型参考 自适应系统转速辨识
相关资源
- OpenCV-俄罗斯方块
- 俄罗斯方块课程设计报告
- 俄罗斯方块AI源代码以及设计文档
- qt写的俄罗斯方块完整代码
- 使用labview制作俄罗斯方块
- Kinect俄罗斯方块源代码及项目
- 俄罗斯方块系统需求规格说明书
- vc俄罗斯方块
- 基于QT实现俄罗斯方块游戏。代码只有
- 俄罗斯方块源码
- 俄罗斯方块vc2008源码
- 16*16点阵俄罗斯方块
- 汇编语言贪吃蛇、俄罗斯方块双任务
- 传智播客版俄罗斯方块源代码
- flash俄罗斯方块
- 纯QML编写的俄罗斯方块小游戏(2.0版
- Qt俄罗斯方块简洁易懂
- 基于51单片机的俄罗斯方块
- linux C 俄罗斯方块源码
- 用WIN32汇编写的俄罗斯方块
- 五个汇编小程序,乘法表,俄罗斯方
- 51单片机点阵俄罗斯方块代码
- 小游戏vs2008 游戏代码
- unity-3D俄罗斯方块JS版
- flash小游戏源代码
- 带动画效果的VC 迷宫游戏源代码.ra
- flash as3.0拼图小游戏源代码
- flash格斗游戏源代码
- cocos2dx v2.2.6 超级玛丽源代码
- 完整的RPG游戏源代码
评论
共有 条评论