Commit 93fd8be1 by BellCodeEditor

save project

parent a5ef2b43
Showing with 9 additions and 5 deletions
......@@ -50,7 +50,7 @@ cube_colors = [
num_list=[]
for i in range(25):
num_list.append([0]*15)
def chock(enter):
def chock(center):
for cube in current_shape:
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:
......@@ -65,14 +65,18 @@ while True:
exit()
if event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT: # 向右
if center[1] < 15:
center[1] += 1
if chock(center)==False:
center[1] -= 1
elif event.key == locals.K_LEFT: # 向左
if center[1] > 1:
center[1] -= 1
if chock(center)==False:
center[1] += 1
elif event.key == locals.K_DOWN: # 向下
if center[0] < 25:
center[0] +=1
if chock(center)==False:
center[0] -= 1
elif event.key == locals.K_UP:
old_indxt=index
index = index+1
......@@ -97,7 +101,7 @@ while True:
center[0] = center[0] - 1
states = False
for cube in current_pos:
num_list[cube[0]-1][cube[1]-1]=color
num_list[cube[0]-1][cube[1]-1] = color
# 将背景图画上去
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