[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] image & sprite module



I've created a 600x750 image, where I've put 80 frame that represent all the
position of a sprite(a spider for the precision), with a trasparent background.
Every frame is 75x75

But I haven't found a way to use it with the sprite module. I use a class 
"spider" that ihnerit from sprite.Sprite, in which I should declare two 
variables that they will use by sprite module: self.image and self.rect. 
Obviusly I cannot load all the image in the sellf.image variable, I need only
a 75x75 rectangle referred to a specific frame. So I've thought this way:

#load the file
self.imagedef = pygame.image.load(filename).convert()

#create a new surface that will contain the frames
self.image = pygame.Surface((75, 75))

#blit the first left-top frame from imagedef to image
self.image.blit(self.imagedef, (0, 0), (0, 0, 75, 75))

#This is my rect
self.rect = (0, 0, 75, 75)


Unfortunately image loses his trasparency and so it hides the display 
background. What can I do?

thank you
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org