Commit 8de9d5c4 by BellCodeEditor

save project

parent 9ded14c8
Showing with 6 additions and 6 deletions
...@@ -56,8 +56,6 @@ num_list=[] ...@@ -56,8 +56,6 @@ num_list=[]
for i in range(25): for i in range(25):
num_list.append([0]*15) num_list.append([0]*15)
def check(center): def check(center):
for cube in current_shape: for cube in current_shape:
if num_list[cube[0]-1][cube[1]-1]!=0: if num_list[cube[0]-1][cube[1]-1]!=0:
return False return False
...@@ -108,16 +106,18 @@ while True: ...@@ -108,16 +106,18 @@ while True:
shape = random.choice(shape_list) shape = random.choice(shape_list)
index = random.randint(0, len(shape)-1) # 随机形状索引 index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index] current_shape = shape[index]
color = random.choice(cube_colors) # 随机选取一种颜色 color = random.choice(cube_colors)
# 随机选取一种颜色
count += 1 count += 1
if count % FPS == 0: # 降落速度的算式 if count % FPS == 0: # 降落速度的算式
center[0] = center[0] + 1 center[0] = center[0] + 1
print(check(center))
if check(center) == False: if check(center) == False:
center[0] = center[0] - 1 center[0] = center[0] - 1
states = False states = False
for cube in current_pos: for cube in current_pos:
num_list[cube[0]-1][cube[1]-1]=color num_list[cube[0]-1][cube[1]-1]=color
print(num_list)
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
...@@ -153,8 +153,8 @@ while True: ...@@ -153,8 +153,8 @@ while True:
if tttt==False: if tttt==False:
new_list[row_index]=num_list[i] new_list[row_index]=num_list[i]
row_index-=1 row_index-=1
num_list=new_list else:
score+=1 score+=1
num_list=new_list num_list=new_list
# 得分 # 得分
text_surface = font.render(str(score), True, (0, 0, 0)) text_surface = font.render(str(score), True, (0, 0, 0))
......
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