Commit 1963d308 by BellCodeEditor

save project

parent 5c5da395
Showing with 7 additions and 5 deletions
...@@ -57,6 +57,7 @@ def check(center): ...@@ -57,6 +57,7 @@ def check(center):
cube=(cube[0]+center[0],cube[1]+center[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: if cube[0]< 1 or cube[1]<1 or cube[0]>grid_num_height or cube[1]>grid_num_width:
return False return False
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:
...@@ -74,14 +75,15 @@ while True: ...@@ -74,14 +75,15 @@ while True:
center[0]+=1 center[0]+=1
if check(center) == False: if check(center) == False:
center[0] -= 1 center[0] -= 1
elif event.key == locals.K_UP: # 变形 elif event.key == locals.K_SPACE: # 变形
old_index=index old_index=index
index+=1 index= index +1
print(old_index)
print(index)
print(len(shape))
if index>=len(shape): if index>=len(shape):
index=0 index=0
print(current_shape) # current_shape = shape[index]
current_shape = shape[index]
print(current_shape)
if check(center)==False: if check(center)==False:
index=old_index index=old_index
current_shape=shape[index] current_shape=shape[index]
......
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