Key Ideas
1The Sprite Class. Every pygame.sprite.Sprite subclass needs exactly two attributes: self.image (a Surface) and self.rect (a Rect for position and collisions).
2Sprite Groups. A Group holds many sprites. group.update() calls every sprite's update(); group.draw(screen) blits every sprite's image at its rect in one line.
3Sprite Layers. pygame.sprite.LayeredUpdates lets each sprite carry a _layer value so draw order is explicit (background behind player behind HUD) instead of insertion order.
4Sprite Sheets. Slice one packed image into individual frames with Surface.subsurface(rect) once at load time, then store the frames in a list for reuse.
5Animated Sprites & States. A state string (e.g. "idle", "walk") indexes into a dict of frame lists, so switching states automatically switches which frames play.
6super().__init__(). Always call this first in a Sprite subclass's __init__ so Pygame's internal bookkeeping wires the object up correctly for Groups.