Main sprite sheet class for managing and extracting sprites from texture atlases.
This class handles loading sprite sheets with alpha support and provides
multiple methods for extracting individual sprites or sprite sequences.
Attributes:
sheet (pygame.Surface): The loaded sprite sheet surface with alpha
filename (str): Path to the sprite sheet file
width (int): Width of the sprite sheet
height (int): Height of the sprite sheet
def __init__(self: Any, filename: str) -> Any
def get_sprite_at_rect(self: Any, rect: pygame.Rect) -> pygame.Surface
def get_sprites_at_regions(self: Any, regions: List[pygame.Rect]) -> List[pygame.Surface]
def get_sprite_grid(self: Any, cell_size: Tuple[int, int], grid_pos: Tuple[int, int]) -> pygame.Surface
def get_surface_drawn_area(self: Any, surface: pygame.Surface, threshold: int = 1) -> pygame.Rect
Time-based animation system for sprite sequences with fade effects.
This class automatically extracts frames from a sprite sheet based on
the provided parameters and manages animation timing with alpha transitions.
Attributes:
spritesheet (SpriteSheet): The source sprite sheet
frames (List[pygame.Surface]): List of animation frames
frame_count (int): Total number of frames in the animation
current_frame_index (int): Current frame index in the animation
duration (float): Total animation duration in seconds
frame_duration (float): Duration of each frame in seconds
last_update_time (float): Last time the animation was updated
scale (Tuple[float, float]): Scale factors for the animation
loop (bool): Whether the animation should loop
playing (bool): Whether the animation is currently playing
fade_in_duration (float): Duration of fade-in effect in seconds
fade_out_duration (float): Duration of fade-out effect in seconds
fade_alpha (int): Current alpha value for fade effects (0-255)
fade_mode (str): Current fade mode: 'in', 'out', or None
flip (Tuple[bool, bool]): Flip flags for horizontal and vertical flipping
def __init__(self: Any, spritesheet_file: str, size: Tuple[int, int], start_pos: Tuple[int, int] = (0, 0), frame_count: int = 1, padding: Tuple[int, int] = (0, 0), margin: Tuple[int, int] = (0, 0), scale: Tuple[float, float] = (1.0, 1.0), duration: float = 1.0, loop: bool = True, fade_in_duration: float = 0.0, fade_out_duration: float = 0.0, flip: tuple = (False, False)) -> Any
def _extract_animation_frames(self: Any) -> List[pygame.Surface]
def _apply_scaling(self: Any) -> Any
def set_duration(self: Any, new_duration: float) -> Any
def play(self: Any) -> Any
def pause(self: Any) -> Any
def get_frame_count(self: Any) -> int
def get_progress(self: Any) -> float
def _apply_fade_effect(self: Any, surface: pygame.Surface) -> pygame.Surface
def update_fade(self: Any) -> Any
def update(self: Any) -> Any
def get_current_frame(self: Any) -> pygame.Surface
def start_fade_in(self: Any, duration: Optional[float] = None) -> Any
def start_fade_out(self: Any, duration: Optional[float] = None) -> Any
def set_fade_alpha(self: Any, alpha: int) -> Any
def is_fade_complete(self: Any) -> bool
def reset(self: Any) -> Any