Reputation: 23
So I want to make the game restart after the player bumps a wall or itself(loses a game) I tried using tkinter but didn't know what to do with it now I'm just confused. I also wanted to ask is there a way to ask the player how if he wants to play again after he loses or some feature like that. And can I use buttons with turtle ?
Upvotes: 2
Views: 1732
Reputation: 27547
Here is how:
import turtle
while True:
# Your game code
again = input("Do you want to play again? ")
if again == 'yes':
screen.clear()
else:
print('Bye!')
break
# If the player enters `yes`, the screen will be cleared, then the program will loop back to the top of this while loop
Upvotes: 2