This is not a problem in itself, because it does not affect anything in the gameplay, but it is a visual bug that bothers a lot, every time it changes state between crouching and standing, the Sprite teleports to the corner for 1 millisecond, is there any way How to avoid this? Here's a piece of code that makes the sprite switch between crouching and standing.
if pressKeys[K_DOWN]:
self.surf = self.crouch_sprites[0]
self.surf = pygame.transform.scale(self.surf, (30, 15))
self.rect = self.surf.get_rect()
self.isCrouch = True
else:
self.surf = self.run_sprites[0]
self.surf = pygame.transform.scale(self.surf, (30, 30))
self.rect = self.surf.get_rect()
self.isCrouch = False
