how to fix really bad lag
tiles = math.ceil(1 + funnypos / bg_height)
for i in range(0, tiles):
screen.blit(bg, (0, funnypos - 300 - (i * bg_height)))
the code is lagging like crazy when the funnypos value is somewhere very high, can someone help me optimize this?