[[[enter image description here](https://i.stack.imgur.com/694bC.png)](https://i.stack.imgur.com/1jiZh.png)](https://i.stack.imgur.com/OG6D7.png)
The 'flag' which called 'win' appears only when the first turtle touches the finish line. Let's say when the 2nd turtle win, It still doesn't count it as a win, it waits for 1st turtle to touch the finish line. I tried fixing It, but I could't do that. So, If the 1st turtle touches the finish line, the 'flag' which is called 'win' should appear in front of the 1st turtle. And same for 2nd and 3rd turtles. But even if 2nd or 3rd turtle win, still the programe ends when the 1st turtle touches the finish line. I will be so gratefull if you help me. If you didn't understand something, you can write me and can explain it to you!
import pygamefrom random import randintpygame.init()clock = pygame.time.Clock()sc = pygame.display.set_mode((400, 350))pl = pygame.image.load('pl.png')t = pygame.image.load('tr.png')win = pygame.image.load('win.png')finish = pygame.image.load('finish.png')r_f = pygame.Rect(360, 60, 60, 60)x1 = x2 = x3 = 0winner = 0while winner == 0: sc.blit(pl, (0, 0)) sc.blit(finish, r_f) r_t1 = pygame.Rect(x1, 64, 60, 60) r_t2 = pygame.Rect(x2, 160, 60, 60) r_t3 = pygame.Rect(x3, 240, 60, 60) sc.blit(t, r_t1) sc.blit(t, r_t2) sc.blit(t, r_t3) x1 = x1 + randint(0,3) x2 = x2 + randint(0,3) x3 = x3 + randint(0,3) if r_t1.colliderect(r_f): winner = 1 sc.blit(win, (300, 20)) if r_t2.colliderect(r_f): winner = 1 sc.blit(win, (300, 100)) if r_t3.colliderect(r_f): winner = 1 sc.blit(win, (300, 200)) pygame.display.update() clock.tick(60)
I tried fixing It, but I could't do that. So, If the 1st turtle touches the finish line, the 'flag' which is called 'win' should appear in front of the 1st turtle. And same for 2nd and 3rd turtles. But even if 2nd or 3rd turtle win, still the programe ends when the 1st turtle touches the finish line.