Commit 22090de3 by BellCodeEditor

save project

parent 381688e9
Showing with 5 additions and 3 deletions
......@@ -48,7 +48,7 @@ current_shape=shape[index]
color=random.choice(cube_colors)
def check(center):
for cube in current_shape:
cube = (cube[0]+cube[0],cube[1]+cube[1])
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
while True:
......@@ -56,6 +56,7 @@ while True:
if event.type == locals.QUIT:
exit()
if event.type == locals.KEYDOWN:
print("jincf")
if event.key == locals.K_RIGHT: # 向右
center[1]=center[1]+1
if check(center)==False:
......@@ -65,9 +66,10 @@ while True:
if check(center)==False:
center[1]=center[1]+1
elif event.key == locals.K_DOWN: # 向下
center[0]=center[0]-1
print("xia")
center[0]=center[0]+1
if check(center)==False:
center[0]=center[0]+1
center[0]=center[0]-1
# 将背景图画上去
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