Commit 755399a4 by BellCodeEditor

auto save

parent 889d9ad1
Showing with 27 additions and 20 deletions
...@@ -16,25 +16,9 @@ clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) ...@@ -16,25 +16,9 @@ clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 载入素材 # 载入素材
background = pygame.image.load('bg.png') background = pygame.image.load('bg.png')
font = pygame.font.Font('STKAITI.TTF', 60) # 字体 font = pygame.font.Font('STKAITI.TTF', 60) # 字体
def check():
if event.key == locals.K_RIGHT:
center[1]=center[1]+1
for cube in fx1:
if cube[1]>=15:
center[1]-=1
break
if event.key == locals.K_LEFT:
center[1]=center[1]-1
for cube in fx1:
if cube[1]<=1:
center[1]+=1
break
if event.key == locals.K_DOWN:
center[0]=center[0]+1
for cube in fx1:
if cube[0]>=25:
center[0]-=1
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)],
...@@ -68,7 +52,30 @@ current_shape = [(0, -1), (0, 0), (0, 1), (-1, 0)] ...@@ -68,7 +52,30 @@ 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)
def check():
if event.key == locals.K_RIGHT:
center[1]=center[1]+1
for cube in fx1:
if cube[1]>=15:
center[1]-=1
break
if event.key == locals.K_LEFT:
center[1]=center[1]-1
for cube in fx1:
if cube[1]<=1:
center[1]+=1
break
if event.key == locals.K_DOWN:
center[0]=center[0]+1
for cube in fx1:
if cube[0]>=25:
center[0]-=1
break
if event.key == locals.K_UP:
fx+=1
if fx>=len(xg):
fx=0
current_shape=xg[fx]
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
......
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