[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Cycling images
Stephen Anderson wrote:
The problem might be where you blit it from the strip to the screen.
Is there any intermediate surface?
no,
class character(pygame.sprite.Sprite):
def __init__(self, img):
pygame.sprite.Sprite.__init__(self)
self.anim = animstrip(img)
self.frame_index = 0
self.image = self.anim[0]
.....
def update(self):
self.image = self.anim[self.frame_index]
if self.image.get_alpha():
print "ALPHA"
.....
....
pygame.init()
screen = pygame.display.set_mode((320, 200))
bg, bg_rect = load_image('bg.jpg')
screen.blit(bg, (0, 0))
pygame.display.flip()
charact = character('image.png')
...
allsprites = pygame.sprite.RenderPlain((charact, ...))
while 1:
.....
allsprites.update()
#Draw Everything
screen.blit(bg, (0, 0))
allsprites.draw(screen)
pygame.display.flip()
in the console this prints "ALPHA"