-2

In Pygame, I'm making a game with highscores. I want to blit a highscore variable onto the screen, called c but whenever I try to run the program, it freezes and I don't know why. How can I blit the variable c to the screen without it freezing? Here is the relevant code:

# High score (printed in the corner)

    c=0
    while c>=0:
        c=c+1

    highscore=myfont6.render("High score:",True, THECOLORS["purple"])
    score=myfont6.render(c, True, THECOLORS["purple"])
    screen.blit(highscore, (20,20))
    screen.blit(score,(40,20))
Brianna
  • 107
  • 2
  • 11

1 Answers1

3

It's this chunk right here. Once you hit this chunk of code, your program will continue to loop forever.

    c=0
    while c>=0:
        c=c+1

I'm guessing you intended to have c increase by one on every loop of the main game loop. If that's the case, just remove the first two lines and call c += 1 on each main game loop.

DJMcMayhem
  • 7,285
  • 4
  • 41
  • 61