有没有办法让我只填充窗口的上半部分?
我希望我的窗口充满新块,但保留一些旧块,以便您可以从一个平台跳到另一个平台。
例如:
def layout():
screen.fill(sky)
for i in range(2):
pygame.draw.rect(screen, (200, 150, 0), (randint(0, 260), randint(0, 200), 100, (100/3)))
pygame.draw.rect(screen, (200, 150, 0), (randint(460, 620), randint(0, 200), 100, (100/3)))
pygame.draw.rect(screen, (200, 150, 0), (randint(0, 260), randint(180, 380), 100, (100/3)))
pygame.draw.rect(screen, (200, 150, 0), (randint(460, 620), randint(180, 380), 100, (100/3)))
pygame.display.update()
while True:
screen.blit(screen, screen_rect)
pygame.display.update()
y += 1
screen.blit(screen,(x,y))
pygame.display.update()
layout()
time.sleep(3)
我希望我的下半部分保持不变,而不是我重新填充每一层的背景并制作新的随机块。有什么想法吗?
谢谢
瑞安