Commit e26efe26 by BellCodeEditor

auto save

parent ecc8309e
Showing with 11 additions and 9 deletions
...@@ -35,6 +35,7 @@ def check(): ...@@ -35,6 +35,7 @@ def check():
if cube[0]>=25: if cube[0]>=25:
center[0]-=1 center[0]-=1
break break
# 俄罗斯方块所有形状 # 俄罗斯方块所有形状
O = [[(0, 0), (0, 1), (1, 0), (1, 1)]] O = [[(0, 0), (0, 1), (1, 0), (1, 1)]]
I = [[(0, -1), (0, 0), (0, 1), (0, 2)], I = [[(0, -1), (0, 0), (0, 1), (0, 2)],
...@@ -56,23 +57,23 @@ L = [[(-1, 0), (0, 0), (1, 0), (1, 1)], ...@@ -56,23 +57,23 @@ L = [[(-1, 0), (0, 0), (1, 0), (1, 1)],
[(-1, 0), (0, 0), (1, 0), (-1, -1)], [(-1, 0), (0, 0), (1, 0), (-1, -1)],
[(0, -1), (0, 0), (0, 1), (-1, 1)]] [(0, -1), (0, 0), (0, 1), (-1, 1)]]
shape_list = [I, J, L, O, S, T, Z] # 7种类型俄罗斯方块 shape_list = [I, J, L, O, S, T, Z] # 7种类型俄罗斯方块
# 一些RGB颜色 # 一些RGB颜色
cube_colors = [ cube_colors = [(204, 153, 153), (102, 102, 153),(153, 0, 102),
(204, 153, 153), (102, 102, 153),(153, 0, 102), (255, 204, 0), (204, 0, 51),(255, 0, 51), (0, 102, 153),
(255, 204, 0), (204, 0, 51),(255, 0, 51), (0, 102, 153), (153, 0, 51), (204, 255, 102), (255, 153, 0)]
(153, 0, 51), (204, 255, 102), (255, 153, 0)]
center = [2, 8] # 第2行第8列 center = [2, 8] # 第2行第8列
current_shape = [(0, -1), (0, 0), (0, 1), (-1, 0)] current_shape = [(0, -1), (0, 0), (0, 1), (-1, 0)]
color=random.choice(cube_colors) color=random.choice(cube_colors)
xg=random.choice(shape_list) xg=random.choice(shape_list)
fx=random.choice(xg) fx=random.choice(xg)
list_=[]
for i in range(25):
list_.append([0]*15)
print(list_)
while True: while True:
color1=color
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
...@@ -86,7 +87,8 @@ while True: ...@@ -86,7 +87,8 @@ while True:
elif event.key == locals.K_DOWN: # 向下 elif event.key == locals.K_DOWN: # 向下
if center[0] < 25: if center[0] < 25:
check() check()
if #else:
# 将背景图画上去 # 将背景图画上去
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