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

[pygame] Making the sprite sheet background transparent



Hey
I want to make the  sprite sheet background as  transparent. How I can do that???
Code and the images is attached with the mail. Thanks in advance.

Ankur Aggarwal
import pygame
from pygame.locals import *
from sys import exit

counter=0

def update():
 global counter
 counter=(counter+1)%5

screen=pygame.display.set_mode((200,200),0,24)
pygame.display.set_caption("Sprite Try")
clock=pygame.time.Clock()
a=[]

image=pygame.image.load("frog.gif").convert()
width,height=image.get_size()


for i in xrange(int(width/44.2)):
  a.append(image.subsurface(i*44.2,0,44.2,41))

while True:
 for i in pygame.event.get():
  if i.type==QUIT:
   exit()


 screen.blit(a[counter],(100,100))
 

 update()
 pygame.display.update()
 clock.tick(5)

Attachment: frog.gif
Description: GIF image