I have been creating a small dynamic lightning(I think it’s called) system in flashpunk. But right now I’m just drawing the “light rays” with a simple Draw.line call, which isnt very good for optimization and I would also like to fill in the gaps in between the rays. It works like this: you put a x and y coordinate for the light source and from there there are lines of a given length drawn out from the source, if they do not hit a solid object they will just draw the lines at there full length and otherwise they will be drawn until the collision point, making a shadow behind the object.Not a very good description and I would have posted a picture but I cant because of me being a new user. Any suggestions on how to solve the problem?
Dynamic lightning help?
AbelToy
(Abel Toy)
#2
I have a similar system (collisions not implemented): http://abeltoy.com/previews/horrorarena/020912-2020.swf (also, just realised it’s from last year).
What I did is draw stuff in a flash Sprite using AS3’s graphics API, and then render it on a Bitmap. So you can use moveTo, lineTo and beginFill to fill the shadows.