Commit 54972e04 by BellCodeEditor

save project

parent 4124b7c4
Showing with 6 additions and 3 deletions
......@@ -54,11 +54,11 @@ current_shape = shape[index]
color = random.choice(cube_colors)
def check(center):
for cube in current_shape:
cube = (cube[0] + center[0], cube[1] + center[1])
# 当前的小方块超出网格的行、列,就返回False
cube = (cube[0] + center[0], cube[1 +center[1]])
if cube[0] < 1 or cube[1] < 1 or cube[0] > grid_num_height \
or cube[1] >grid_num_width:
return False
if num_list[cube[0]-1][cube[1]-1] != 0:
return False
......@@ -107,7 +107,10 @@ while True:
shape = random.choice(shape_list)
index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index]
color = random.choice(cube_colors) # 随机选取一种颜色
color = random.choice(cube_colors)
# 随机选取一种颜色
count += 1
if count % FPS == 0: # 降落速度的算式
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