Reputation: 1
if rounds == 20:
response2 = input("Ok the game has now finished. I hope you had fun playing because I sure did. If you want, type 'restart' to play again.")
if response2.lower() == "restart":
start_game()
elif playerpoints >= 10:
print("Wow you did quite well. Your score is " + str(playerpoints)
(img = pygame.image.load('TrophyImage.png'))
(pygame.init())
(size = (1000, 1000))
(screen = pygame.display.set_mode(size))
(done = False)
(clock = pygame.time.Clock())
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill(WHITE)
screen.blit(img,(0,0))
pygame.display.flip()
clock.tick(60)
pygame.quit()
I've already defined the colors at the beginning of the code so they aren't the issue.
I'm trying to load a picture of a trophy which I have saved. When I run this program, it says invalid syntax but doesn't highlight anything. The I beam pointer just goes to the "while not done" so I'm guessing therein lies the problem.
Upvotes: 0
Views: 119
Reputation: 74655
You need to remove the parenthesis around the assignments. (X = Y)
needs to be X = Y
. Because assignments are not permitted in expression contexts.
>>> (X = Y)
File "<stdin>", line 1
(X = Y)
^
SyntaxError: invalid syntax
>>> X = Y
Upvotes: 1