I am trying to make a small car game, but I ran into an issue, the background scrolls twice from up to down before it freezes, making weird shapes in the process. For some reason, if the background scrolled from down to up, no errors happen.
here is the code of the scrolling background
def main():
run = True
FPS = 60
clock = pygame.time.Clock()
BGY = 0
BGY2 = -BG.get_height()
def redraw():
win.blit(BG, (0,BGY-100))
win.blit(BG, (0,BGY2-100))
pygame.display.update()
while run:
clock.tick(FPS)
redraw()
BGY += 2.5
BGY2 += 2.5
if BGY < BG.get_height() * -1:
BGY = -BG.get_height()
if BGY2 < BG.get_height() * -1:
BGY2 = -BG.get_height()
main()