Löve "Light vs. Shadow" Engine [0.4.3]
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Löve "Light vs. Shadow" Engine [0.4.3]
I haven't used this lib in a while but I think that the shadows are stored in a canvas, try checking the coordinates against the shadow canvas and see if it's alpha is bigger than 0 if so then it's not visible else it is
Re: Löve "Light vs. Shadow" Engine [0.4.3]
This is the impression I got from trying to understand the code, that it doesn't do calculation for visible objects, rather than just draw shadows from all of the objects. I guess one way to solve it would be going through all of the edges and seeing if any point in the edge has alpha over 0. I shall think about this, I was kind of hoping there would be easy way to store the data about which objects edges it would draw but I suppose it is not possible due to having to clip some edges so the corner points might not be same anymore.Ranguna259 wrote:I haven't used this lib in a while but I think that the shadows are stored in a canvas, try checking the coordinates against the shadow canvas and see if it's alpha is bigger than 0 if so then it's not visible else it is
Anyways thank you for the answer, it kind of confirmed what I thought the engine was doing. I might try to roll something on my own to clip the shadow areas against objects, but it might be slower than just doing simple get.point comparing
-
- Prole
- Posts: 3
- Joined: Fri Jun 20, 2014 5:21 pm
Re: Löve "Light vs. Shadow" Engine [0.4.3]
I am relatively new to love2d and have just implemented this awesome library into a little game project of mine. I am using a home-made entities system (a bastardisation of Goature's tutorial one) to deal with the multitude of projectiles and other such things. Many of these entities have a short lifespan in game, so I looked for a function to remove a specific shadow body, but all I found was clearBodys() which just removes all of the shadow casting bodies from the lightWorld they are in, yet no one has raised this as an issue so I must assume I missed something fundamental.
Do I really have to recreate every shadow casting entity every time one of the projectiles on screen hits a wall and has to call Die()? It seems incredibly inefficient, but like I said I am new to love2d, new to lua and so digging through the light.lua file and making my own function to do such a thing is difficult without a good understanding of it. I tried, but I don't properly get how the thing works and so my attempts were just aping clearBodys() and trying different things.
Oh, also the two functions related to this on the wiki are dead links.
Sorry if this is banal, but I just can't seem to find the answer on my own!
Do I really have to recreate every shadow casting entity every time one of the projectiles on screen hits a wall and has to call Die()? It seems incredibly inefficient, but like I said I am new to love2d, new to lua and so digging through the light.lua file and making my own function to do such a thing is difficult without a good understanding of it. I tried, but I don't properly get how the thing works and so my attempts were just aping clearBodys() and trying different things.
Oh, also the two functions related to this on the wiki are dead links.
Sorry if this is banal, but I just can't seem to find the answer on my own!
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Löve "Light vs. Shadow" Engine [0.4.3]
Funny, no one has actualy talked about that yet.
But yeah there is a way to remove objects, use the clear() function:
By the way PriorBlue how's translation and scalling going ? Because I just tested them and they're still a little messed up
But yeah there is a way to remove objects, use the clear() function:
Code: Select all
object.clear()
-
- Prole
- Posts: 3
- Joined: Fri Jun 20, 2014 5:21 pm
Re: Löve "Light vs. Shadow" Engine [0.4.3]
Thank you! I knew I was missing something ridiculously simple, for some reason my searches of the light.lua file didn't find that.
Re: Löve "Light vs. Shadow" Engine [0.4.3]
Great job! One question: is it possible to get lights with height = 1/2 of light`s range? Any easy way to get all light and shadow effects squeezed vertically?
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: Löve "Light vs. Shadow" Engine [0.4.3]
Where is per-pixel Shadow ??? When I do newImage it just creates a rectangle shadow wut?
Re: Löve "Light vs. Shadow" Engine [0.4.3]
Did someone have any luck solving the love.graphics.scale issue? I'm developing a game that allows the player to change the screen size anytime they want, but the scale function seems to mess with everything. Thanks in advance!
-
- Prole
- Posts: 3
- Joined: Fri Jun 20, 2014 5:21 pm
Re: Löve "Light vs. Shadow" Engine [0.4.3]
Ok, firstly thank you for the prompt reply to my previous question, I still can't believe I didn't see it earlier myself, but there we go.
Now I have three more questions
Firstly, is it possible to generate sources of negative light? The game I am creating (and have spent years planning and designing) needs bolts of light and bolts of darkness as projectiles. Ideally they would both emit their own 'light' source (or anti-light in the case of the dark one), creating a really cool aesthetic. So I would like to know if it is possible, if not can the engine be jury-rigged to allow it, and and how one would go about doing so.
Secondly, my game is from a totally top-down perspective, that is the camera is sitting aligned to a normal to the 'plane' of the world at all times. Because of this I can and have been using rotation on my characters and things that move. Is it possible to rotate the shadow-bodies and their respective maps in real-time? If so, how?
And finally a derp question, but I seem to ask a lot of those: How do I get objects that cast shadows to be affected by shadows cast by other objects but not their own. For example: I have two apples on my screen and a lightsource, both apples have circular shadow bodies, and the shadow of one apple falls on the other, yet the brightness of the shadowed apple is not effected by that shadow. How do I fix this? It doesn't seem to work in the complex demo either, but it seems like a simple feature, if the shadow body did not produce a dark circle where it is, I could simply draw the shadows after the apples and so have the apples affected by shadow just as the background textures are.
Now I have three more questions
Firstly, is it possible to generate sources of negative light? The game I am creating (and have spent years planning and designing) needs bolts of light and bolts of darkness as projectiles. Ideally they would both emit their own 'light' source (or anti-light in the case of the dark one), creating a really cool aesthetic. So I would like to know if it is possible, if not can the engine be jury-rigged to allow it, and and how one would go about doing so.
Secondly, my game is from a totally top-down perspective, that is the camera is sitting aligned to a normal to the 'plane' of the world at all times. Because of this I can and have been using rotation on my characters and things that move. Is it possible to rotate the shadow-bodies and their respective maps in real-time? If so, how?
And finally a derp question, but I seem to ask a lot of those: How do I get objects that cast shadows to be affected by shadows cast by other objects but not their own. For example: I have two apples on my screen and a lightsource, both apples have circular shadow bodies, and the shadow of one apple falls on the other, yet the brightness of the shadowed apple is not effected by that shadow. How do I fix this? It doesn't seem to work in the complex demo either, but it seems like a simple feature, if the shadow body did not produce a dark circle where it is, I could simply draw the shadows after the apples and so have the apples affected by shadow just as the background textures are.
Who is online
Users browsing this forum: No registered users and 12 guests