# 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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pygame-animation-player",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "pygame, animation, sprites, game development",
"author": null,
"author_email": "de-dust-enjoyer <dedustenjoyer@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/25/f1/d2149678914cdc94748412246bf0b236550ba81da695b327e52c94f7c536/pygame_animation_player-1.0.4.tar.gz",
"platform": null,
"description": "# Pygame Animation Player\r\n\r\nA simple and animation player for pygame sprites that supports:\r\n\r\n- Multiple animation types (sprite sheets and individual frames)\r\n- One-shot and looping animations \r\n- Frame-rate independent timing\r\n- Easy integration with pygame sprites\r\n\r\n## Installation\r\n\r\n```bash\r\npip install pygame-animation-player\r\n```\r\n\r\n\r\n### Implementation\r\n\r\n```python\r\nimport pygame\r\nfrom pygame_animation_player import Animation, AnimationPlayer\r\n\r\n# Create animations\r\nidle_anim = Animation(fps=0, frame1)\r\nwalk_anim = Animation(fps=12, *walk_frames)\r\nattack_anim = Animation(fps=20, attack_spritesheet, tilesize=(16,16), one_shot=True)\r\n# Add to your sprite\r\nclass Player(pygame.sprite.Sprite):\r\n def __init__(self):\r\n super().__init__()\r\n # self.image before AnimationPlayer.__init__()\r\n self.image = None\r\n self.animation_player = AnimationPlayer(\r\n self, \r\n idle=idle_anim,\r\n walk=walk_anim,\r\n attack=attack_anim\r\n )\r\n \r\n def update(self, dt):\r\n self.animation_player.update(dt)\r\n\r\n if walking:\r\n self.animation_player.play(\"walk\")\r\n else:\r\n self.animation_player.play(\"idle\")\r\n\r\n if attack:\r\n self.animation_player.play(\"attack\", \r\n restart= True, \r\n force_finish= True)\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple animation player for pygame sprites",
"version": "1.0.4",
"project_urls": {
"Bug Reports": "https://github.com/de-dust-enjoyer/pygame-animation-player/issues",
"Homepage": "https://github.com/de-dust-enjoyer/pygame-animation-player",
"Source": "https://github.com/de-dust-enjoyer/pygame-animation-player"
},
"split_keywords": [
"pygame",
" animation",
" sprites",
" game development"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2e2b57d07e0930c1dc2ea9d1f1a7eac4b3638eb349b5569f694f0572f529fe36",
"md5": "7354f5225eafb4eeb7922cf2595ee55e",
"sha256": "26e98214b9c64365a7686a75f263434883808ed179ba9006fbeaaf2cd2b6fbe9"
},
"downloads": -1,
"filename": "pygame_animation_player-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7354f5225eafb4eeb7922cf2595ee55e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 6180,
"upload_time": "2025-08-17T15:31:33",
"upload_time_iso_8601": "2025-08-17T15:31:33.637264Z",
"url": "https://files.pythonhosted.org/packages/2e/2b/57d07e0930c1dc2ea9d1f1a7eac4b3638eb349b5569f694f0572f529fe36/pygame_animation_player-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "25f1d2149678914cdc94748412246bf0b236550ba81da695b327e52c94f7c536",
"md5": "ee1ef561dd258ffff45091c3536974ef",
"sha256": "16374027dfaa1b11f5ddde9fe11f1494c663718f8472f0492ce7572d05f190d4"
},
"downloads": -1,
"filename": "pygame_animation_player-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "ee1ef561dd258ffff45091c3536974ef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5375,
"upload_time": "2025-08-17T15:31:34",
"upload_time_iso_8601": "2025-08-17T15:31:34.591329Z",
"url": "https://files.pythonhosted.org/packages/25/f1/d2149678914cdc94748412246bf0b236550ba81da695b327e52c94f7c536/pygame_animation_player-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-17 15:31:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "de-dust-enjoyer",
"github_project": "pygame-animation-player",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pygame-animation-player"
}