I am trying to read in images from a sprite sheet, the problem is when I use a Surface to get a single image the background becomes black and if I use pygame.Surface.set_colorkey(image, [0, 0, 0])
then it removes the black that is in the single image. The background of the images is transparent.
class SpriteSheet:
def __init__(self, path):
pygame.init()
self.path = path
self.sheet = pygame.image.load(path).convert_alpha()
def get_images(self):
sprite = pygame.Surface((IMAGE_SIZE, IMAGE_SIZE)).convert_alpha()
sprite.blit(self.sheet, (0,0), (0, 0, IMAGE_SIZE, IMAGE_SIZE))
pygame.Surface.set_colorkey(sprite, [0, 0, 0])
print(pygame.Surface.get_colorkey(sprite))
return sprite