[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Cycling images



Congratulations!  I'm glad you figured it out!

On 4 Mar 2004 at 23:48, lorca wrote:

> FIXED!!! :D
> 
> 
> def animstrip(img, width=0, colorkey=None):
>    if not width:
>       width = img.get_height()
> 
>    size = width, img.get_height()
>    images = []
>    for x in range(0, img.get_width(), width):
>       i = pygame.Surface(size, img.get_flags(), img)
>       i.blit(img, (0, 0), ((x, 0), size))
> 
>       # si se seteo colorkey toma ese color como transparente
>       if colorkey is not None:
>          if colorkey is -1:
>             # toma el color del pixel a la posicion (0,0)
>             colorkey = i.get_at((0,0))
>          i.set_colorkey(colorkey, RLEACCEL)
> 
>       images.append(i)
>    return images
> 
> yeah!!!
> -=[ i = pygame.Surface(size, img.get_flags(), img) ]=-
> 
>