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
Downloads
- Shadows.py - The source code.
Copyright notice
- Source code is Public Domain.
Comment this project:
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!
So sorry, I meant ray CASTER. :-)
Hmm... I was just thinking. Could this code be modified into a ray tracer? :O
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.
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
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.
