Pygame Tutorials - Sprite Module Introduction — pygame v2.6.0 documentation

PHOTO EMBED

Tue Nov 05 2024 15:10:58 GMT+0000 (Coordinated Universal Time)

Saved by @saisingar3927

class RenderUpdatesDraw(RenderClear):
    """call sprite.draw(screen) to render sprites"""
    def draw(self, surface):
        dirty = self.lostsprites
        self.lostsprites = []
        for s, r in self.spritedict.items():
            newrect = s.draw(screen) #Here's the big change
            if r is 0:
                dirty.append(newrect)
            else:
                dirty.append(newrect.union(r))
            self.spritedict[s] = newrect
        return dirty
content_copyCOPY

https://www.pygame.org/docs/tut/SpriteIntro.html