I'm trying to learn how use sprite sheets on pygame , and on my first try my sprite for some reason have a black background , i don't know how i can fix this problem , i alredy put 000 on the color key but when i do this the sprite be all buggy
import pygame
class Spritesheet(pygame.sprite.Sprite):
def __init__(self, filename, *groups):
super().__init__(*groups)
self.filename = filename
self.spritesheet = pygame.image.load(filename).convert()
def get_sprite(self, x, y, w, h):
sprite = pygame.Surface((w, h))
sprite.set_colorkey(( 0 , 0 , 0))
sprite.blit(self.spritesheet, (0, 0), (x, y, w, h))
return sprite
pass
colorkey 0 0 0
colorkey with any number