Commit 480379d1 by BellCodeEditor

save project

parent 80f0318f
Showing with 16 additions and 6 deletions
......@@ -44,16 +44,14 @@ cube_colors = [
(204, 153, 153), (102, 102, 153),(153, 0, 102),
(255, 204, 0), (204, 0, 51),(255, 0, 51), (0, 102, 153),
(153, 0, 51), (204, 255, 102), (255, 153, 0)]
suiji=random.choice(shape_list)
index=random.randint(0,len(suiji)-1)
color=random.choice(cube_colors)
center = [2, 8] # 第2行第8列
current_shape = suiji[index]
def chock(center):
for cube in current_shape:
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
con=0
strats=False
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -80,7 +78,19 @@ while True:
if chock(center)==False:
index=oid_index
current_shape = suiji[index]
if strats==False:
strats=True
suiji=random.choice(shape_list)
index=random.randint(0,len(suiji)-1)
color=random.choice(cube_colors)
center = [2, 8] # 第2行第8列
current_shape = suiji[index]
con+=1
if con%FPS==0:
center[0] += 1
if chock(center)==False:
center[0]-= 1
strats=False
# 将背景图画上去
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