Commit 85b0daf5 by BellCodeEditor

save project

parent 0951c0bd
Showing with 12 additions and 12 deletions
......@@ -53,9 +53,6 @@ def check(center):
return False
while True:
shape = random.choice(shape_list)
way = random.randint(0,len(shape)-1)
color = random.choice(cube_colors)
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
......@@ -68,10 +65,6 @@ while True:
center[1] -= 1
if check(center) == False:
center[1]+=1
elif event.key == locals.K_DOWN: # 向下
center[0] += 1
if check(center) == False:
center[0]-=1
elif event.key == locals.K_UP:
old_way=way
way +=1
......@@ -81,6 +74,18 @@ while True:
if check(center) == False:
way=old_way
current_shape=shape[way]
if states==False:
states=True
center=[2,8]
shape = random.choice(shape_list)# 形状
way = random.randint(0,len(shape)-1)# 方向
color = random.choice(cube_colors)# 颜色
count += 1 # 向下
if count%FPS==0:# 减速公式
center[0] += 1
if check(center) == False:
center[0]-=1
states=False
# 将背景图画上去
screen.blit(background, (0, 0))
# 计算出所有小方块的行、列位置
......@@ -96,11 +101,6 @@ while True:
# 得分
text_surface = font.render(str(score), True, (0, 0, 0))
screen.blit(text_surface, (350,70))
count+=1
if count%FPS==0:
center[0]+=1
if check(center)==False:
center[0]-=1
# 刷新画面
pygame.display.update()
clock.tick(FPS)
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