[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] fade in/out...thanks for your help!



Hi all!

Again I have a little problem with surfaces holding png images (png files 
have been imported with convert_alpha() )...
I simply could not figure out how to fade in/fade out my sprites (I assume 
convert_alpha() implies per-pixel alpha... thus I think set_alpha has no 
effect is that right...???)

I therefore tried to use the Numeric module together with surfarray in order 
to achieve the effect...but I simply can't get it to work... here is my 
current approach:

Player(pygame.sprite.Sprite):

...
def fade(self, percentage):
   alphaArray = pygame.surfarray.pixels_alpha(self.image)
   Numeric.multiply(alphaArray, (1 + (0.01 * percentage)), alphaArray)


I either get "return array has incorrect type" (I know that error but if I 
"cast" the array to Float first and then I get no error message but simply 
do not see any effect on screen)... maybe it has something to do the sprite 
module???)

Thanks very much already in advance!




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org