If your sprite object's .image attribute isn't a Surface, then it's not really a Sprite. All Sprite objects need to have a .image attribute that is a Surface, and a .rect attribute that is a Rect.
just give your load_sprite attribute some other name. On Mon, Nov 10, 2008 at 8:52 PM, Michael Fiano <[EMAIL PROTECTED]> wrote: > 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 >