[pygame] Masking Test: Simulated Lighting

2007-01-21 Thread Kris Schnee
I was thinking about how to simulate a lighting effect in Pygame: a character with a portable light source in a dark room. The code below does something like that by creating a black mask covering the screen, then cutting a partially-transparent hole in it around a certain point. For extra

[pygame] Masking Test: Simulated Lighting (Follow-Up)

2007-01-21 Thread Kris Schnee
I played with the idea more and was able to make a moving light source by, each frame, making a solid black mask, using pygame.draw.circle to draw a transparent circle on it, then blitting the holey mask onto the screen. This turned everything black except where the light had been placed, and

Re: [pygame] Masking Test: Simulated Lighting

2007-01-21 Thread Richard Jones
On Sunday 21 January 2007 22:47, Kris Schnee wrote: I was thinking about how to simulate a lighting effect in Pygame: a character with a portable light source in a dark room. The code below does something like that by creating a black mask covering the screen, then cutting a

Re: [pygame] Masking Test: Simulated Lighting

2007-01-21 Thread Richard Jones
[sorry about that empty reply folks - hit the wrong dang button]

Re: [pygame] Masking Test: Simulated Lighting

2007-01-21 Thread Nicola Larosa
Kris Schnee wrote: I was thinking about how to simulate a lighting effect in Pygame: a character with a portable light source in a dark room. Marius Gedminas wrote: This reminds me of something... Here it is: Escape from Anathema Mines from the second Ludum Dare

Re: [pygame] Masking Test: Simulated Lighting

2007-01-21 Thread Marius Gedminas
On Sun, Jan 21, 2007 at 10:17:32PM +0100, Nicola Larosa wrote: Kris Schnee wrote: I was thinking about how to simulate a lighting effect in Pygame: a character with a portable light source in a dark room. Marius Gedminas wrote: This reminds me of something... Here it is: Escape

Re: [pygame] Masking Test: Simulated Lighting (Follow-Up)

2007-01-21 Thread Kris Schnee
Kamilche wrote: Try the following code. It uses a gradient light. I'm trying to figure out how your example (much better than mine) works. It looks like the key is the last line of this function: def RefreshNight(night, alpha, light, x, y): a = NIGHTCOLOR[3] alpha.fill([a, a, a])

Re: [pygame] Masking Test: Simulated Lighting (Follow-Up)

2007-01-21 Thread Kamilche
Kris Schnee wrote: Kamilche wrote: Try the following code. It uses a gradient light. I'm trying to figure out how your example (much better than mine) works. It looks like the key is the last line of this function: def RefreshNight(night, alpha, light, x, y): a = NIGHTCOLOR[3]

Re: [pygame] Masking Test: Simulated Lighting (Follow-Up)

2007-01-21 Thread Lenard Lindstrom
Kris Schnee wrote: Kamilche wrote: Try the following code. It uses a gradient light. I'm trying to figure out how your example (much better than mine) works. It looks like the key is the last line of this function: def RefreshNight(night, alpha, light, x, y): a = NIGHTCOLOR[3]

Re: [pygame] Masking Test: Simulated Lighting

2007-01-21 Thread Nicola Larosa
Marius Gedminas wrote: Nice one. Mind if I steal it? Of course not, since it's not mine. Paraphrasing Roberto Benigni in the Jim Jarmusch Down by Law movie: I quote, you quote, we all quote for the (repeat ad lib). (original was I scream... to much better effect. ;-) ) -- Nicola Larosa -