I\'m working on making a game for my programming class using python. I don\'t know how to give the option to the player again when they lose, or quit the game. I am using python
First of, one suggestion. People will be more likely to help you if you show them what you've tried.
anyhow.
What I would do is wrap your entire game loop in a function. Like so:
def game_loop():
while True:
# check for the QUIT event
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
....
next when ever your game ends(I'm assuming it does have a condition that makes it end), call a game over screen function. In your game over screen function, you could first fill the window with a color, then blit any text to the screen you wan to show the user, such as "Press any key to play again". Then you would check if any key was pressed and if so call the game loop function. You also need to check if the user is trying to close the window.
Then call the game over screen function like so:
#pseudo code
if game_has_ended == True:
game_over_screen()