<filename>source/Game/assets/sprite_sheet.py
# ---------------------------------------------------
# Import Packages
# ---------------------------------------------------
import pygame
import numpy

# ---------------------------------------------------
# Import Config
# ---------------------------------------------------
from config.settings.config_colors import *
from config.settings.config_game import *
from config.settings.config_layer import *
from config.settings.config_player import *
from config.settings.config_resolution import *

# ---------------------------------------------------
# Sprite Sheet Class
# ---------------------------------------------------
class SpriteSheet:
    def __init__(self, image, image_config) -> None:
        self.sheet = pygame.image.load(image).convert()
        self.sheet_config = image_config

    def get_sprite(self, index):

        with open(self.sheet_config) as config:
            array = numpy.loadtxt(config, delimiter=',')

        image_index = int(array[index]) if array.any() else 0

        default_size_sprite = pygame.Surface([TILESIZE, TILESIZE])
        default_size_sprite.blit(self.sheet, (0, 0), (image_index * TILESIZE, 0, TILESIZE, TILESIZE))
        default_size_sprite.set_colorkey(BLACK)

        scaled_size_sprite = pygame.Surface([TILESIZE * SCALING_FACTOR, TILESIZE * SCALING_FACTOR])
        scaled_size_sprite.blit(pygame.transform.scale(default_size_sprite, (TILESIZE * SCALING_FACTOR, TILESIZE * SCALING_FACTOR)), (0, 0))
        scaled_size_sprite.set_colorkey(BLACK)

        return scaled_size_sprite
<filename>source/Game/assets/sprite_sheet.py
# ---------------------------------------------------
# Import Packages
# ---------------------------------------------------
import pygame
import numpy

# ---------------------------------------------------
# Import Config
# ---------------------------------------------------
from config.settings.config_colors import *
from config.settings.config_game import *
from config.settings.config_layer import *
from config.settings.config_player import *
from config.settings.config_resolution import *

# ---------------------------------------------------
# Sprite Sheet Class
# ---------------------------------------------------
class SpriteSheet:
    def __init__(self, image, image_config) -> None:
        self.sheet = pygame.image.load(image).convert()
        self.sheet_config = image_config

    def get_sprite(self, index):

        with open(self.sheet_config) as config:
            array = numpy.loadtxt(config, delimiter=',')

        image_index = int(array[index]) if array.any() else 0

        default_size_sprite = pygame.Surface([TILESIZE, TILESIZE])
        default_size_sprite.blit(self.sheet, (0, 0), (image_index * TILESIZE, 0, TILESIZE, TILESIZE))
        default_size_sprite.set_colorkey(BLACK)

        scaled_size_sprite = pygame.Surface([TILESIZE * SCALING_FACTOR, TILESIZE * SCALING_FACTOR])
        scaled_size_sprite.blit(pygame.transform.scale(default_size_sprite, (TILESIZE * SCALING_FACTOR, TILESIZE * SCALING_FACTOR)), (0, 0))
        scaled_size_sprite.set_colorkey(BLACK)

        return scaled_size_sprite
# --------------------------------------------------- # Import Packages # --------------------------------------------------- # --------------------------------------------------- # Import Config # --------------------------------------------------- # --------------------------------------------------- # Sprite Sheet Class # ---------------------------------------------------