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
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
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
[sorry about that empty reply folks - hit the wrong dang button]
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
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
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])
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]
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]
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 -
10 matches
Mail list logo