Skip to content Skip to sidebar Skip to footer

Pygame - Sprite Movement Causes Layers

Im trying to make a rain effect with pygame but it seems as if the background is not cleaning up before updating the sprites. this is what it looks like when i execute the code..

Solution 1:

This is the line you use to clear the screen:

screen.blit(background, (100, 100))

In other words; you're clearing the screen starting at x=100, y=100. Since pygame coordinates starts from topleft and extends to the right and downwards, you're not clearing the screen left of x=100 and above y=100.

Simple fix is blitting at 0, 0 as you did at the start of the program.

screen.blit(background, (0, 0))

Post a Comment for "Pygame - Sprite Movement Causes Layers"