Commit 662ec188 by BellCodeEditor

save project

parent 2c904b67
Showing with 7 additions and 2 deletions
......@@ -45,7 +45,7 @@ cube_colors = [
center = [2, 8] # 第2行第8列
current_shape = [(0, -1), (0, 0), (0, 1), (-1, 0)]
shape = random.choice(shape_list)
way = random.choice(shape)
way = random.randint(0,len(shape)-1)
color = random.choice(cube_colors)
while True:
......@@ -62,11 +62,13 @@ while True:
elif event.key == locals.K_DOWN: # 向下
if center[0] < 25:
center[0] += 1
elif event.key == locals.K_UP: # 变形
# 将背景图画上去
screen.blit(background, (0, 0))
# 计算出所有小方块的行、列位置
current_pos = []
for cube in way:
for cube in shape[way]:
pos = (cube[0] + center[0], cube[1] + center[1])
current_pos.append(pos)
# 取出所有小方块的行、列位置,计算坐标,绘制俄罗斯方块
......@@ -80,3 +82,5 @@ while True:
# 刷新画面
pygame.display.update()
clock.tick(FPS)
def check():
center[1]=center[1]+1
\ No newline at end of file
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