The typical Pygame application loop has to:
Remove screen.fill(BLACK)
form update
:
class Sprite(pygame.sprite.Sprite):
# [...]
def update(self, moveX, moveY):
self.rect.x += moveX
self.rect.y += moveY
# screen.fill(BLACK) <--- DELETE
Implement the following application loop (based on your previous question):
while carryOn == True:
# handle events
for event in pygame.event.get():
if event.type==pygame.QUIT:
carryOn=False
# update
# [...]
# clear display
screen.fill(BLACK)
# draw sprites
all_sprites_list.draw(screen)
# update display
pygame.display.flip()
clock.tick(60)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…