Page 8 of 12

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Sat May 31, 2014 10:22 pm
by Ranguna259
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]

Posted: Sun Jun 01, 2014 10:42 am
by Muris
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
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.

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

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Fri Jun 20, 2014 5:33 pm
by uberlemming
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!

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Sat Jun 21, 2014 7:35 pm
by Ranguna259
Funny, no one has actualy talked about that yet.
But yeah there is a way to remove objects, use the clear() function:

Code: Select all

object.clear()
By the way PriorBlue how's translation and scalling going ? Because I just tested them and they're still a little messed up :P

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Sun Jun 22, 2014 5:15 am
by uberlemming
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]

Posted: Sun Jun 22, 2014 9:41 am
by AlexYeCu
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?

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Sun Jun 22, 2014 5:20 pm
by Ranguna259
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]

Posted: Wed Jul 02, 2014 2:01 am
by qaisjp
This is... brilliant.

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Thu Jul 03, 2014 1:32 am
by megalukes
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!

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Posted: Sat Jul 05, 2014 11:26 am
by uberlemming
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.