Commit eae7149a by BellCodeEditor

save project

parent 35d87765
Showing with 59 additions and 3 deletions
......@@ -39,7 +39,7 @@ L = [[(-1, 0), (0, 0), (1, 0), (1, 1)],
[(0, -1), (0, 0), (0, 1), (1, -1)],
[(-1, 0), (0, 0), (1, 0), (-1, -1)],
[(0, -1), (0, 0), (0, 1), (-1, 1)]]
shape_list = [I, J, L, O, S, T, Z] # 7种类型俄罗斯方块
shape_list = [O, I, L, S, Z, T, J] # 7种类型俄罗斯方块
# 一些RGB颜色
cube_colors = [
......@@ -77,9 +77,9 @@ while True:
if check(center) == False:
center[1] = center[1] - 1
elif event.key == locals.K_DOWN: # 向下
elif event.key == locals.K_DOWN:
while(check(center) != False): # 向下
center[0] = center[0] + 1
if check(center) == False:
center[0] = center[0] - 1
elif event.key == locals.K_UP: # 向上键
......@@ -91,6 +91,62 @@ while True:
if check(center) == False:
index = old_index
current_shape = shape[index]
elif event.key == locals.K_i: # 向下
center[0] = center[0] -1
shape = shape_list[1]
index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index]
color = random.choice(cube_colors)
if check(center) == False:
center[0] = center[0] +1
elif event.key == locals.K_o: # 向下
center[0] = center[0] -1
shape = shape_list[0]
index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index]
color = random.choice(cube_colors)
if check(center) == False:
center[0] = center[0] +1
elif event.key == locals.K_l: # 向下
center[0] = center[0] -1
shape = shape_list[2]
index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index]
color = random.choice(cube_colors)
if check(center) == False:
center[0] = center[0] +1
elif event.key == locals.K_s: # 向下
center[0] = center[0] -1
shape = shape_list[3]
index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index]
color = random.choice(cube_colors)
if check(center) == False:
center[0] = center[0] +1
elif event.key == locals.K_z: # 向下
center[0] = center[0] -1
shape = shape_list[4]
index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index]
color = random.choice(cube_colors)
if check(center) == False:
center[0] = center[0] +1
elif event.key == locals.K_t: # 向下
center[0] = center[0] -1
shape = shape_list[5]
index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index]
color = random.choice(cube_colors)
if check(center) == False:
center[0] = center[0] +1
elif event.key == locals.K_j: # 向下
center[0] = center[0] -1
shape = shape_list[6]
index = random.randint(0, len(shape)-1) # 随机形状索引
current_shape = shape[index]
color = random.choice(cube_colors)
if check(center) == False:
center[0] = center[0] +1
if gameover == False:
if states == False:
states = True
......
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