Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

2 Learning Character Animation Through SpriteSheet #33

@SauravGitte

Description

@SauravGitte

Issue: Bring Life to SwarmShot: Pet Animation Integration

Prerequisites

Before starting, ensure you have the following set up:

  1. Python: Install the latest version (Python 3.8 or above).
  2. Pygame: Install the latest version using:
    pip install pygame

NOTE: Paths and File Organization:

All file paths should be relative to the root directory (SwarmShot folder).
Ex. Use 'Sprites/Sprites_Player/Char_003.png' for the character sprite path.
Replace \ with / in file paths, as Python treats \ as an escape sequence. For example:

Incorrect: Sprites\Sprites_Player\Char_003.png
Correct:   Sprites/Sprites_Player/Char_003.png

How to Run any File

We recommend running all files by keeping the root folder as the current directory (Swarmshot Folder ). Means , First Open the SwarmShot folder using V S Code . Using the left Explorer panel , Open the practice.py file in 📁Example_of_Game/Practice_Animation Folder . Run this practice.py file ( either by pressing run code button or typing following in the V S code terminal ).

python .\Example_of_Game\Practice_Animation\practice.py

image
image

You can see a character animated through a sprite sheet . We can clearly see that both moving and Idle animations are correctly established. Explanation is in comments (written at the top ) in practice.py file.

Task Details

Create a python file with following naming in the 📁Practice_Animation Folder (which lies in 📁Example_of_Game )

  • If you're from IIITA: Roll_No_Name.py
  • If you're not from IIITA: OpenSource_GithubUserName.py

Use practice.py as the base code and build upon it . (Copy code from practice.py file into your python file )

Replace the Player Character with Favorite pet

Replace the current player sprite (Char_003.png) with a pet sprite from the repository and implement:

  1. Movement animations for the chosen pet.
  2. Idle animations when the player isn't moving.

Steps:

  1. Navigate to the Sprites/Sprites_Pet/ folder in the repository. Select a pet sprite:
    • PET_BlueBird.png
    • PET_Fox.png
    • PET_Racoon.png
  2. Update the Player class to load your chosen pet sprite.
    Example:
    self.sprite_sheet = pygame.image.load("Sprites/Sprites_Pet/PET_Fox.png").convert_alpha()
  3. Extract animation frames using the same logic as Char_003.png in practice.py.
  4. Implement proper movement and idle animations for the pet. ( Both animations are in the same pet spritesheet ! )
  • Result shall be like :
    BIRDSPRITESHEET_Blue FOXSPRITESHEET

Resources :

Submission Guidelines

  1. Create a new Python file in this format:
    • If you're from IIITA: Roll_No_Name.py
    • If you're not from IIITA: OpenSource_GithubUserName.py
  2. PR description shall be :
    Issue: #33
    Added my favourite pet .

Tips

  • Check the properties of your spritesheet to calculate frame dimensions and grid size.
  • Refer to the practice.py file for detailed explanations and example code.
  • Test your implementation thoroughly to ensure smooth animations.
    image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Points: 30open-for-allAny one can work on it without getting assigned, every PR can merge

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions