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

Re: [pygame] sprite engine



Kamilche schrieb:
Do you have a link to the new pygame 'blend mode' feature you mentioned? I've never heard of it, and Google came up with nothing.

--Kamilche

Hi

If I remember right Illumen from #pygame said some days ago he added this feature to the pygame CVS ( http://www.pygame.org/wiki/cvs ). I did not look into the CVS but it should be there.

I forggot a imortant line in the last (pseudo) code fragment:


#----------------------------------------------------
if sprite.rect.colliderect(oldrect): #<------------ important
unionrect = oldrect.union(sprite.rect)
if unionrect.width*unionrect.height< 2*sprite.area: # assumes that oldrect and sprite.rect has same area,
# if not its only for one frame
# perhaps I should also save the oldrect area to do it right
screenupdates.append( unionrect )
else:
screenupdates.append( spr.rect )
screenupdates.append( oldrect )
else: # <------------------------------- and from here on
screenupdates.append( spr.rect )
screenupdates.append( oldrect )
#----------------------------------------------------



~DR0ID