Metadata-Version: 2.4
Name: pygame-animation-player
Version: 1.0.2
Summary: A simple animation player for pygame sprites
Author-email: de-dust-enjoyer <simonhartig75@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/de-dust-enjoyer/pygame-animation-player
Project-URL: Bug Reports, https://github.com/de-dust-enjoyer/pygame-animation-player/issues
Project-URL: Source, https://github.com/de-dust-enjoyer/pygame-animation-player
Keywords: pygame,animation,sprites,game development
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Software Development :: Libraries :: pygame
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pygame>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Dynamic: license-file

# Pygame Animation Player

A simple and animation player for pygame sprites that supports:

- Multiple animation types (sprite sheets and individual frames)
- One-shot and looping animations  
- Frame-rate independent timing
- Easy integration with pygame sprites

## Installation

```bash
pip install pygame-animation-player
```


### Implementation

```python
import pygame
from pygame_animation_player import Animation, AnimationPlayer

# Create animations
idle_anim = Animation(fps=0, frame1)
walk_anim = Animation(fps=12, *walk_frames)
attack_anim = Animation(fps=20, attack_spritesheet, tilesize=(16,16), one_shot=True)
# Add to your sprite
class Player(pygame.sprite.Sprite):
    def __init__(self):
        super().__init__()
        # self.image before AnimationPlayer.__init__()
        self.image = None
        self.animation_player = AnimationPlayer(
            self, 
            idle=idle_anim,
            walk=walk_anim,
            attack=attack_anim
        )
    
    def update(self, dt):
        self.animation_player.update(dt)

        if walking:
            self.animation_player.play("walk")
        else:
            self.animation_player.play("idle")

        if attack:
            self.animation_player.play("attack", 
                                        restart= True, 
                                        force_finish= True)
```
