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

Re: [pygame] Fade to black question...



On Tue, Mar 10, 2009 at 8:32 AM, Ty ... <ty.sqlite@xxxxxxxxx> wrote:
> I'm trying to get a fade to black working, to that end I've written a
> simple program just to try it out... the (partial) code looks like
> this:
>
> self.screen.fill(white)
> self.screen.blit(self.image, self.size, self.size)
> print self.screen.get_at((4,4));
> self.screen.fill((2,2,2), None, BLEND_SUB)
> print self.screen.get_at((4,4));
> self.screen.fill((2,2,2), None, BLEND_SUB)
> print self.screen.get_at((4,4));
> self.screen.fill((2,2,2), None, BLEND_SUB)
> print self.screen.get_at((4,4));
> sys.exit()

I think maybe you want BLEND_MULT instead of BLEND_SUB?  I don't know,
I rarely use flags.  What I would do for fade to black is create a
black surface, and call set_alpha() on the surface with an increasing
alpha value on each frame, and blit it.