Commit e05149fa by BellCodeEditor

save project

parent c7aaf246
Showing with 14 additions and 2 deletions
......@@ -15,7 +15,14 @@ pygame.display.set_caption("俄罗斯方块")
clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 载入素材
background = pygame.image.load('bg.png')
font = pygame.font.Font('STKAITI.TTF', 60) # 字体
font = pygame.font.Font('STKAITI.TTF', 60)
num_list=[]
# s = [0]*15
# print(s)
for i in range(25):
num_list.append([0]*15)
print(num_list)
# 字体
# 俄罗斯方块所有形状
O = [[(0, 0), (0, 1), (1, 0), (1, 1)]]
......@@ -58,6 +65,8 @@ def check(center):
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
if num_list[cube[0]-1][cube[1]-1] !=0:
return False
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -97,7 +106,10 @@ while True:
center[0]=center[0]+1
if check(center)==False:
center[0]-=1
states=False
states=False
for cube in current_pos:
num_list[cube[0]-1][cube[1]-1]=color
# print(num_list)
# 将背景图画上去
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