0

this is my first attempt on trying to make my highscore blit on my end_screen but my problem is that it doesnt show the saved score it only shows that I have 0 points I am not sure how to fix this

what I have done is blitting the score text on my end_screen as well it just seems to show my score is 0 everytime

        font = pygame.font.Font("do.ttf", 50)
        text = font.render("           YOUR Fish " + str(apple), True, (255,255,255))
        rect = text.get_rect()
        window.blit(text,rect)

# end screen
def end_screen():

    # this makes it             
    snow_list=[]
    no_of_circles=100;
    clock = pygame.time.Clock()
    FPS = 60
    clock.tick(FPS)
    for i in range(no_of_circles):
        x = random.randrange(0, 800)
        y = random.randrange(0, 700)
        snow_list.append([x,y])

    # the background image
        
    red = (200,0,0)
    green = (255,250,250)
    bright_red = (255,250,0)
    bright_green = (0,255,0)
    clock = pygame.time.Clock()
    intro = True
    while intro:
        clock.tick(FPS)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                intro = False
                pygame.quit()




    # GAME INTRO IMAGE
        button("Click To Play!",40,310,220,60,green,bright_green,crash)
        bls = pygame.image.load("end.png")
        window.blit(bls,(0,0))

        font = pygame.font.Font("do.ttf", 50)
        text = font.render("           YOUR Fish " + str(apple), True, (255,255,255))
        rect = text.get_rect()
        window.blit(text,rect)

        for point in snow_list:
            point[1]+=1
            pygame.draw.circle(window, (255,255,255), point, 2)

            if(point[1] >= 600):
                point[0] = random.randrange(0, 600)
                point[1] = random.randrange(-10, -5)

        clock.tick(FPS)
        pygame.display.update()

Habib Ismail
  • 69
  • 5
  • 16
  • is ```apple``` the variable that stores the point score? If so, where is it defined and used? – ewokx Jul 14 '20 at 00:50
  • yes thats the score its used when my player collides with a falling object [video](https://gyazo.com/e374792479d7a90b457c8704c0774c7c) heres my full code: https://pastebin.com/15D62RXC – Habib Ismail Jul 14 '20 at 01:04
  • first thing I'd suggest you do is to rename your ```apple``` point variable to something else. You have an apple class and a global apple variable in the same scope, which will cause some confusion. – ewokx Jul 14 '20 at 01:11
  • also, I noticed you set ```apple = 0``` on line 633 in main_loop(). That's going to reset the high score to 0, I would believe. – ewokx Jul 14 '20 at 01:16

0 Answers0