Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 Learning Character Animation Through SpriteSheet #33

Open
SauravGitte opened this issue Dec 23, 2024 · 1 comment
Open

2 Learning Character Animation Through SpriteSheet #33

SauravGitte opened this issue Dec 23, 2024 · 1 comment
Labels
open-for-all Any one can work on it without getting assigned, every PR can merge Points: 30

Comments

@SauravGitte
Copy link
Collaborator

SauravGitte commented Dec 23, 2024

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
@SauravGitte SauravGitte added Points: 30 open-for-all Any one can work on it without getting assigned, every PR can merge labels Dec 23, 2024
@SauravGitte
Copy link
Collaborator Author

Its Open for all ! No need to claim . If you have any doubts you may ask in OPENCODE Discord Server

This was referenced Dec 25, 2024
kavyan256 added a commit to kavyan256/SwarmShot that referenced this issue Dec 25, 2024
Issue: opencodeiiita#33
Added my favourite pet .
@SauravGitte SauravGitte changed the title Learning Character Animation Through SpriteSheet 2 Learning Character Animation Through SpriteSheet Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-for-all Any one can work on it without getting assigned, every PR can merge Points: 30
Projects
None yet
Development

No branches or pull requests

1 participant