Demo of a walking directional sprite animation
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2023-03-19 13:05:11 +01:00
.flake8 Initial checkin 2023-03-18 20:31:43 +01:00
.gitignore Initial commit 2023-03-18 20:09:26 +01:00
LICENSE Initial commit 2023-03-18 20:09:26 +01:00
README.md Update README.md 2023-03-19 13:05:11 +01:00
sara-walking.gif Demo anim added 2023-03-18 20:40:19 +01:00
sara.py Chose wrong anim frames 2023-03-18 21:41:41 +01:00
SaraFullSheet.png Initial checkin 2023-03-18 20:31:43 +01:00

pygame-sara-walking

Demo of a walking directional sprite animation as answer to a question on the pygame reddit.

The pygame.sprite.Sprite class makes use of two attributes, rect and image.

Changing the attribute image to a @property function, the class can select different sprites on its current state (direction, phase in animation, ...).

Below short demonstration shows a cycle of 6 animation steps for the 4 directions nort, south, east, west.

Attributions

Since I'm no artist, the sprite is Sara, the logo of opengameart.org, downloaded from here:

https://opengameart.org/content/lpc-sara

This sheet of Sara is created by Stephen "Redshrike" Challener, submitted by William.Thompsonj. Original Sara by Mandi Paugh as mascott for https://opengamearts.org

Example

Screen recording of Sara walking