Commit b8c18469 by BellCodeEditor

save project

parent a53a79dd
Showing with 16 additions and 1 deletions
...@@ -7,7 +7,8 @@ grid_size = 20 # 格子大小 ...@@ -7,7 +7,8 @@ grid_size = 20 # 格子大小
grid_num_width = 15 # 横向格子数量 grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量 grid_num_height = 25 # 纵向格子数量
FPS = 30 FPS = 30
sb=0
states=False
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((460, 500)) screen = pygame.display.set_mode((460, 500))
pygame.display.set_caption("俄罗斯方块") pygame.display.set_caption("俄罗斯方块")
...@@ -49,6 +50,7 @@ s=random.choice(shape_list) ...@@ -49,6 +50,7 @@ s=random.choice(shape_list)
index=random.randint(0,len(s)-1) # 第2行第8列 index=random.randint(0,len(s)-1) # 第2行第8列
current_shape = s[index] current_shape = s[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])
...@@ -83,6 +85,19 @@ while True: ...@@ -83,6 +85,19 @@ while True:
if check(center)== False: if check(center)== False:
index=old_index index=old_index
current_shape=s[index] current_shape=s[index]
if states==False:
states=True
center = [2, 8]
s=random.choice(shape_list)
index=random.randint(0,len(s)-1) # 第2行第8列
current_shape = s[index]
color=random.choice(cube_colors)
sb+=1
if sb %FPS==0:
center[0]=center[0]+1
if check(center)==False:
center[0]=center[0]-1
states=False
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (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