From 6c43e3b3ab77ec0c3c57763178723a50e4dcac52 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Wed, 19 Apr 2023 02:09:53 +0200 Subject: Added the ghost sprites to the game. --- src/Player.py | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'src/Player.py') diff --git a/src/Player.py b/src/Player.py index 430a974..21c1f7e 100644 --- a/src/Player.py +++ b/src/Player.py @@ -1,33 +1,9 @@ from typing import List from Direction import DIRECTION +from util import get_sprites import pygame -def get_sprites(sprite_sheet) -> List: - sheet_width, sheet_height = sprite_sheet.get_size() - sprite_width, sprite_height = 32, 32 - rows = sheet_height // sprite_height - columns = sheet_width // sprite_width - sprites = [] - - for row in range(rows): - for col in range(columns): - x = col * sprite_width - y = row * sprite_height - - # Create a new surface for the current sprite and blit it from the - # sprite sheet onto this new surface - new_sprite_surface = pygame.Surface( - (sprite_width, sprite_height), pygame.SRCALPHA) - new_sprite_surface.blit( - sprite_sheet, (0, 0), (x, y, x + sprite_width, y + sprite_height)) - - # Add this new surface to our list of sprites - sprites.append(new_sprite_surface) - - return sprites - - class Player(): def __init__(self, sprite_sheet): self.x = 30 * 17 - 15 -- cgit v1.2.3