Commit a53f8559 by BellCodeEditor

save project

parent 1c7e7e19
Showing with 7 additions and 3 deletions
......@@ -10,8 +10,10 @@ grid_num_height = 25 # 纵向格子数量
FPS = 30 # 帧率
count = 0
states = False
# 创建窗口
num_list=[]
current_pos = []
for i in range(25):
num_list.append([0]*15)# 创建窗口
screen = pygame.display.set_mode((460, 500))
pygame.display.set_caption("俄罗斯方块")
clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
......@@ -54,6 +56,9 @@ def check(center):
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:
num_list[cube[0]][cube[1]]=color
return False
while True:
for event in pygame.event.get():
......@@ -101,7 +106,6 @@ while True:
# 将背景图画上去
screen.blit(background, (0, 0))
# 计算出所有小方块的行、列位置
current_pos = []
for cube in current_shape:
pos = (cube[0] + center[0], cube[1] + center[1])
current_pos.append(pos)
......
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