Shadows - beta 1

Small demo that shows a way to implement some nice ray casting effect.
Draw obstacles with the mouse. Move the light with the arrow keys.

Screenshot

Related links

  • Python - The python programming language.
  • PyGame - Game development for Python.

Downloads

Copyright notice

  • Source code is Public Domain.

Comment this project:

Your name:
Your email (hidden):
Message:
Enter the validation code :
Private! (visible for webmaster only)

joe 2011-02-02 11:59:21

@rmasta - i'm 5 yrs late but the reason why you get that extra light is because the calculated polygon is based off the light and it's not large enough.
in GetPolygon, change
L = self.LIGHT_SIZE + 10
to
L = self.LIGHT_SIZE * 1.2
and your polygon is now large enough to cover the light radius for all sizes.

Thank alot John, you make indie developers like me very grateful!

pymike 2008-11-10 17:11:32

So sorry, I meant ray CASTER. :-)

pymike 2008-11-10 17:10:50

Hmm... I was just thinking. Could this code be modified into a ray tracer? :O

Ian Mallett 2008-03-02 06:00:37

Hi!
This demo is fabulous! I'm not sure how it works, and I have tried several times to make sense of it. Can anyone give me the theory? Thanks.

rmasta 2006-12-02 11:03:55

very cool game to play around with
I made + and - to resize the circle
your code is buggy though: http://img301.imageshack.us/my.php?image=abuggabugabuce0.gif

Answer:

Naah...I wouldn't say it's a bug ;-) You just have to change some more of the code to be able to set a larger circle. Not just the size of the light.

View all