I am having problems adding my player sprite to a sprite group since
self.image needs a surface, though it is a list of animation frames for the 
player in my code and I can't
figure out what I need to do. Can anybody give me some pointers? Thanks.

self.image = load_sprite('player.png')

class load_sprite:
        def __init__(self, filename):
                self.sheet = pygame.image.load(os.path.join('data', 'graphics', 
filename))
        def imgat(self, rect, colorkey = None):
                rect = Rect(rect)
                image = pygame.Surface(rect.size).convert()
                image.blit(self.sheet, (0, 0), rect)
                if colorkey is not None:
                        if colorkey is -1:
                                colorkey = image.get_at((0, 0))
                        image.set_colorkey(colorkey, RLEACCEL)
                return image
        def imgsat(self, rects, colorkey = None):
                imgs = []
                for rect in rects:
                        imgs.append(self.imgat(rect, colorkey))
                return imgs

Reply via email to