Fading out (increasing transparency) Pygame Function Using set_alpha Not Working -
i'm trying make function fades out (increases transparency of) sprite overlay, large color block covers screen. however, reason, fade-in function works intended. fade-out function draws sprite overlay @ max opacity (255), doesn't show desired fade-out effect in spite of using same algorithm fade-in function does, though different range values, of course.
edit:
alright, think know deal here.
the fade-out function draws overlay on background... , leaves there keeps continuously drawing on moron.
i it.
i'm gonna toy around this.
here 2 functions:
this 1 works:
def fade_in(self): self.faderinuse.add(self) x in range(0, 256, self.rate): self.colorfade.set_alpha(x) screen.blit( self.colorfade, ( 0, 0 ) ) pygame.display.flip() clock.tick(15) self.faderinuse.clear( screen, screen ) drawscreen()
this one, however, doesn't quite cut it:
def fade_out(self): self.faderinuse.add(self) x in range( 255, -1, ( self.rate * -1 ) ): self.colorfade.set_alpha(x) screen.blit( self.colorfade, ( 0, 0 ) ) pygame.display.flip() clock.tick(15) self.faderinuse.clear( screen, screen ) drawscreen()
can show how u created self.colorfade object. and, did use self.colorfade.convert_alpha()
? have use convert_alpha able change alpha value of object.
Comments
Post a Comment