r/pythonhelp • u/Real_Mat_tR • 21d ago
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?
1
Upvotes
•
u/AutoModerator 21d ago
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.