Commit 130ff8aa by BellCodeEditor

save project

parent cd247171
Showing with 14 additions and 1 deletions
......@@ -44,7 +44,18 @@ cube_colors = [
(255, 204, 0), (204, 0, 51),(255, 0, 51), (0, 102, 153),
(153, 0, 51), (204, 255, 102), (255, 153, 0)]
center = [2, 8] # shape
center = [2, 8] # 第2行第8列
shape = random.choice(cube_list)
index = random.randint(0, len(shape)-1)
current =random.choice(cube_colors)
def check(center):
for cube in current_shape:
cube = (cube[0] + center[0], cube[1] +center[1])
#当前小方块超出网格的行、列,就返回False
if cube[0] < 1 or cube[1] < 1 or cube[0] > grid_num_height \
or cube[1] >gird_num_width:
return False
while True:
for event in pygame.event.get():
......@@ -55,6 +66,8 @@ while True:
if center[1] < 15:
center[1] += 1
elif event.key == locals.K_LEFT: # 向左
center[1] = center[1] - 1 # 左移一1列
for cube in current_pos
if center[1] > 1:
center[1] -= 1
elif event.key == locals.K_DOWN: # 向下
......
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