[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] image & sprite module
On Fri, 18 Oct 2002 08:35:59 -0700
Pete Shinners <shredwheat@attbi.com> wrote:
> anyways, you pretty much had the solution in your post, just a small
> colorkey problem. hopefully these bites of code show you where you can take
> it next.
Thank you Pete, I've found your ideas very interesting, in these days I've
found also another way that use surfarray module(thanks to your tutorial :)
I've created a new file image 75x75(the same of the frames) and totally
trasparent, called "dummy", every frame I "clean" the old image with this
dummy and then I blit the new frame on it:
def __init__(self, filename, dummyfile):
#load default image
self.imagedef = pygame.image.load(filename).convert()
#load dummy trasparent image
self.dummy = pygame.image.load(dummyfile).convert()
self.image = self.dummy
#create an array of dummy
self.dummyarray = pygame.surfarray.array2d(self.dummy)
def update(self, x, y):
#clean the old image with dummy
pygame.surfarray.blit_array(self.image, self.dummyarray)
#blit the new frame on image
self.image.blit(self.imagedef, (0, 0), (x, y, 75, 75))
What do you think of this way?
thank you
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org