Refactor code

This commit is contained in:
Gabriel Augendre 2018-04-30 20:40:57 +02:00
parent f06e0d5d47
commit 789be9c5d8
No known key found for this signature in database
GPG key ID: F360212F958357D4

View file

@ -108,8 +108,8 @@ def main():
screen.blit(text, text_rect) screen.blit(text, text_rect)
pygame.display.flip() pygame.display.flip()
while True: restart = False
restart = False while not restart:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == pglocals.QUIT: if event.type == pglocals.QUIT:
logger.info('Received QUIT event') logger.info('Received QUIT event')
@ -119,8 +119,6 @@ def main():
if event.key == pglocals.K_r: if event.key == pglocals.K_r:
logger.debug('Restarting game') logger.debug('Restarting game')
restart = True restart = True
if restart:
break
clock.tick(5) clock.tick(5)