Commit f22a8a28 by BellCodeEditor

save project

parent 9e044895
Showing with 8 additions and 1 deletions
...@@ -7,6 +7,8 @@ grid_size = 20 ...@@ -7,6 +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
count=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("俄罗斯方块")
clock = pygame.time.Clock() clock = pygame.time.Clock()
...@@ -46,7 +48,7 @@ color=random.choice(cube_colors) ...@@ -46,7 +48,7 @@ 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])
if cube[0]<1 or cube[1]<1 or cube[0]>grid_num_height_num or cube[1]>grid_num_width: if cube[0]<1 or cube[1]<1 or cube[0]>grid_num_height or cube[1]>grid_num_width:
return False return False
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -74,6 +76,11 @@ while True: ...@@ -74,6 +76,11 @@ while True:
if check(center) == False: if check(center) == False:
ID=old_ID ID=old_ID
current_shape=current_x[ID] current_shape=current_x[ID]
count+=1
if count%FPS==0:
center[0] += 1
if check(center)==False:
states=False
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
current_pos = [] current_pos = []
for cube in current_shape: for cube in current_shape:
......
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