Commit 54972e04 by BellCodeEditor

save project

parent 4124b7c4
Showing with 7 additions and 4 deletions
...@@ -54,11 +54,11 @@ current_shape = shape[index] ...@@ -54,11 +54,11 @@ current_shape = shape[index]
color = random.choice(cube_colors) color = random.choice(cube_colors)
def check(center): def check(center):
for cube in current_shape: for cube in current_shape:
cube = (cube[0] + center[0], cube[1] + center[1]) cube = (cube[0] + center[0], cube[1 +center[1]])
# 当前的小方块超出网格的行、列,就返回False if cube[0] < 1 or cube[1] < 1 or cube[0] > grid_num_height \
if cube[0] < 1 or cube[1] < 1 or cube[0] > grid_num_height \
or cube[1] >grid_num_width: or cube[1] >grid_num_width:
return False return False
if num_list[cube[0]-1][cube[1]-1] != 0: if num_list[cube[0]-1][cube[1]-1] != 0:
return False return False
...@@ -107,7 +107,10 @@ while True: ...@@ -107,7 +107,10 @@ 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
......
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