Skip to content

Instantly share code, notes, and snippets.

@nasajpledu
Created September 9, 2021 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasajpledu/ae68b1b93d3698f932400bed33f196d7 to your computer and use it in GitHub Desktop.
Save nasajpledu/ae68b1b93d3698f932400bed33f196d7 to your computer and use it in GitHub Desktop.
# End game if collision between player and enemy or treasure
# Close game if we lose and restart game loop if we win
if player.detect_collision(enemy_0):
is_game_over = True
did_win = False
text = font.render('You Lose!', True, BLACK_COLOR)
self.game_screen.blit(text, (275, 350))
pygame.display.update()
clock.tick(1)
break
elif player.detect_collision(dest):
is_game_over = True
did_win = True
text = font.render('You Win!', True, BLACK_COLOR)
self.game_screen.blit(text, (275, 350))
pygame.display.update()
clock.tick(1)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment