You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rather than creating temporary lists when filtering sprites for collision detection, use generator expressions. This is more efficient as it means that fewer lists have to be created in memory.
e.g.
sprites_collided = pygame.sprite.spritecollide(self, (s for s in self._collidable_sprites if s.visible), False)
The text was updated successfully, but these errors were encountered:
Rather than creating temporary lists when filtering sprites for collision detection, use generator expressions. This is more efficient as it means that fewer lists have to be created in memory.
e.g.
The text was updated successfully, but these errors were encountered: