Commit ce839632 by BellCodeEditor

auto save

parent 3047ccc3
Showing with 4 additions and 5 deletions
...@@ -6,8 +6,8 @@ pygame.init() # 初始化 ...@@ -6,8 +6,8 @@ pygame.init() # 初始化
score = 0 score = 0
grid_size = 20 # 格子大小 grid_size = 20 # 格子大小
grid_num_width = 15 # 横向格子数量 grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量 grid_num_height = 258 # 纵向格子数量
FPS = 30 # 帧率 FPS = 100 # 帧率
count = 0 count = 0
states = False states = False
...@@ -51,8 +51,7 @@ def check(center): ...@@ -51,8 +51,7 @@ 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 # 当前的小方块超出网格的行、列,就返回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
while True: while True:
...@@ -91,7 +90,7 @@ while True: ...@@ -91,7 +90,7 @@ 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