Commit ff1d1bf6 by BellCodeEditor

save project

parent 675e1422
Showing with 4 additions and 20 deletions
......@@ -6,7 +6,7 @@ score = 0
grid_size = 20 # 格子大小
grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量
FPS = 5
FPS = 3
count=0
# 创建窗口
screen = pygame.display.set_mode((460, 500))
......@@ -14,10 +14,8 @@ pygame.display.set_caption("俄罗斯方块")
clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 载入素材
background = pygame.image.load('bg.png')
font = pygame.font.Font('STKAITI.TTF', 60)
f1 = pygame.font.Font('STKAITI.TTF', 30) # 字体
go=False
st=False
font = pygame.font.Font('STKAITI.TTF', 60) # 字体
# 俄罗斯方块所有形状
O = [[(0, 0), (0, 1), (1, 0), (1, 1)]]
I = [[(0, -1), (0, 0), (0, 1), (0, 2)],
......@@ -62,8 +60,6 @@ def check(center):
for i in range(25):
sp.append([0]*15)
while True:
if sat==False:
sat=True
color=random.choice(cube_colors)
......@@ -72,17 +68,9 @@ while True:
index=random.randint(0,len(shape)-1)
current_shape =shape[index]
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
if event.type == locals.KEYDOWN:
if go ==True:
go==False
sp=[]
score=0
for i in range(25):
sp.append([0]*15)
if event.key == locals.K_LEFT:
center[1]=center[1]-1 # 向右
if check(center)==False:
......@@ -151,12 +139,8 @@ while True:
else:
score+=1
sp=sq
if sp[1][7]!=0:
go=True
t1 = f1.render("你个呲球,点任意键重玩", True, (255, 0, 0))
screen.blit(t1, (150,100))
# 得分
text_surface = font.render(str(score), True, (0, 0, 0))
screen.blit(text_surface, (350,70))
# 刷新画面
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment