import pygame, sys, random, time
def new_draw():
screen.fill(white)
for i in range(1, 21):
for j in range(10):
bolck = background[i][j]
if bolck:
pygame.draw.rect(screen, blue, (j * 25 + 1, 500 - i * 25 + 1, 23, 23))
x, y = centre
for i, j in active:
i += x
j += y
pygame.draw.rect(screen, blue, (j * 25 + 1, 500 - i * 25 + 1, 23, 23))
pygame.display.update()
def move_LR(n):
"""n=-1代表向左,n=1代表向右"""
x, y = centre
y += n
for i, j in active:
i += x
j += y
if j < 0 or j > 9 or background[i][j]:
break
else:
centre.clear()
centre.extend([x, y])
def rotate():
x, y = centre
l = [(-j, i) for i, j in active]
for i, j in l:
i += x