Skip to main content

load and play sprite sheet animations.

Project description

Overview

This library provides an easy-to-use SpriteAnimation class for Pygame that handles sprite sheet animations. It allows you to animate 2D characters or objects using a sprite sheet made up of equal-sized frames.

Key Features

  • Loads animations from a sprite sheet using customizable frame size
  • Automatically handles frame timing and animation playback
  • Supports looping and one-shot animations
  • Allows optional frame scaling to a new size
  • Supports horizontal flipping of animations
  • Easily reset animations at any time

Basic Usage

from sprite_animation import SpriteAnimation import pygame

pygame.init() screen = pygame.display.set_mode((640, 480))

#Create animation anim = SpriteAnimation("spritesheet.png", frame_size=(32, 32), frame_duration=100, final_size=(64, 64))

#Main loop clock = pygame.time.Clock() running = True while running: dt = clock.tick(60) #Ms since last frame for event in pygame.event.get(): if event.type == pygame.QUIT: running = False

anim.update(dt)

screen.fill((0, 0, 0))
anim.draw(screen, (100, 100))
pygame.display.flip()

pygame.quit()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SpriteSheetAnim-1.0.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SpriteSheetAnim-1.0.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file SpriteSheetAnim-1.0.0.tar.gz.

File metadata

  • Download URL: SpriteSheetAnim-1.0.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for SpriteSheetAnim-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8a633415bbd6a0c334dacd459271637c8899af37dfc66e18812ebcc2c9c2b42a
MD5 ed5aedc80604bb8ce6b40f5bcbfccd8b
BLAKE2b-256 be9cc8fe5da1c3b72d09fdfb11f6c8c7c643188cef5a55475db9a6585d782562

See more details on using hashes here.

File details

Details for the file SpriteSheetAnim-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for SpriteSheetAnim-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c079b0693f9aca277109c04ca1c4f4e3be6a2af7ea0df7c98c40ed56605f0f36
MD5 c2fef78e5506ef26270c1c602a5e9d6c
BLAKE2b-256 8b6a1c0692c3fe05427ac7b4c545c1a10c4902196f5c141f4170cd02d3d78fb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page