while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
sys.exit()
windowSurface.fill(BLACK)
for block in blocks:
    block.move()
block.draw()
pygame.display.update()
time.sleep(0.02)
Python: как отскочить от края экрана